File indexing completed on 2025-01-18 10:14:53
0001
0002
0003 #if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLValid)
0004 #define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLValid
0005
0006 #include <xercesc/framework/XMLErrorReporter.hpp>
0007 #include <xercesc/util/XercesDefs.hpp>
0008 #include <xercesc/dom/DOMError.hpp>
0009
0010 XERCES_CPP_NAMESPACE_BEGIN
0011
0012
0013 #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))
0014 # pragma GCC diagnostic push
0015 # pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
0016 #endif
0017
0018 class XMLValid
0019 {
0020 public :
0021 enum Codes
0022 {
0023 NoError = 0
0024 , E_LowBounds = 1
0025 , ElementNotDefined = 2
0026 , AttNotDefined = 3
0027 , NotationNotDeclared = 4
0028 , RootElemNotLikeDocType = 5
0029 , RequiredAttrNotProvided = 6
0030 , ElementNotValidForContent = 7
0031 , BadIDAttrDefType = 8
0032 , InvalidEmptyAttValue = 9
0033 , ElementAlreadyExists = 10
0034 , MultipleIdAttrs = 11
0035 , ReusedIDValue = 12
0036 , IDNotDeclared = 13
0037 , UnknownNotRefAttr = 14
0038 , UndeclaredElemInDocType = 15
0039 , EmptyNotValidForContent = 16
0040 , AttNotDefinedForElement = 17
0041 , BadEntityRefAttr = 18
0042 , UnknownEntityRefAttr = 19
0043 , ColonNotValidWithNS = 20
0044 , NotEnoughElemsForCM = 21
0045 , NoCharDataInCM = 22
0046 , DoesNotMatchEnumList = 23
0047 , AttrValNotName = 24
0048 , NoMultipleValues = 25
0049 , NotSameAsFixedValue = 26
0050 , RepElemInMixed = 27
0051 , FeatureUnsupported = 28
0052 , GroupContentRestricted = 29
0053 , UnknownBaseDatatype = 30
0054 , NoContentForRef = 31
0055 , DatatypeError = 32
0056 , ProhibitedAttributePresent = 33
0057 , IllegalXMLSpace = 34
0058 , WrongTargetNamespace = 35
0059 , SimpleTypeHasChild = 36
0060 , NoDatatypeValidatorForSimpleType = 37
0061 , GrammarNotFound = 38
0062 , DisplayErrorMessage = 39
0063 , NillNotAllowed = 40
0064 , NilAttrNotEmpty = 41
0065 , FixedDifferentFromActual = 42
0066 , NoDatatypeValidatorForAttribute = 43
0067 , GenericError = 44
0068 , ElementNotQualified = 45
0069 , ElementNotUnQualified = 46
0070 , VC_IllegalRefInStandalone = 47
0071 , NoDefAttForStandalone = 48
0072 , NoAttNormForStandalone = 49
0073 , NoWSForStandalone = 50
0074 , VC_EntityNotFound = 51
0075 , PartialMarkupInPE = 52
0076 , DatatypeValidationFailure = 53
0077 , UniqueParticleAttributionFail = 54
0078 , NoAbstractInXsiType = 55
0079 , NoDirectUseAbstractElement = 56
0080 , NoUseAbstractType = 57
0081 , BadXsiType = 58
0082 , NonDerivedXsiType = 59
0083 , ElemNoSubforBlock = 60
0084 , TypeNoSubforBlock = 61
0085 , AttributeNotQualified = 62
0086 , AttributeNotUnQualified = 63
0087 , IC_FieldMultipleMatch = 64
0088 , IC_UnknownField = 65
0089 , IC_AbsentKeyValue = 66
0090 , IC_KeyNotEnoughValues = 67
0091 , IC_KeyMatchesNillable = 68
0092 , IC_DuplicateUnique = 69
0093 , IC_DuplicateKey = 70
0094 , IC_KeyRefOutOfScope = 71
0095 , IC_KeyNotFound = 72
0096 , NonWSContent = 73
0097 , EmptyElemNotationAttr = 74
0098 , EmptyElemHasContent = 75
0099 , ElemOneNotationAttr = 76
0100 , AttrDupToken = 77
0101 , ElemChildrenHasInvalidWS = 78
0102 , E_HighBounds = 79
0103 , W_LowBounds = 80
0104 , W_HighBounds = 81
0105 , F_LowBounds = 82
0106 , F_HighBounds = 83
0107 };
0108
0109 static bool isFatal(const XMLValid::Codes toCheck)
0110 {
0111 return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));
0112 }
0113
0114 static bool isWarning(const XMLValid::Codes toCheck)
0115 {
0116 return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
0117 }
0118
0119 static bool isError(const XMLValid::Codes toCheck)
0120 {
0121 return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
0122 }
0123
0124 static XMLErrorReporter::ErrTypes errorType(const XMLValid::Codes toCheck)
0125 {
0126 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
0127 return XMLErrorReporter::ErrType_Warning;
0128 else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
0129 return XMLErrorReporter::ErrType_Fatal;
0130 else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
0131 return XMLErrorReporter::ErrType_Error;
0132 return XMLErrorReporter::ErrTypes_Unknown;
0133 }
0134 static DOMError::ErrorSeverity DOMErrorType(const XMLValid::Codes toCheck)
0135 {
0136 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
0137 return DOMError::DOM_SEVERITY_WARNING;
0138 else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
0139 return DOMError::DOM_SEVERITY_FATAL_ERROR;
0140 else return DOMError::DOM_SEVERITY_ERROR;
0141 }
0142
0143 private:
0144
0145
0146
0147 XMLValid();
0148 };
0149
0150 #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))
0151 # pragma GCC diagnostic pop
0152 #endif
0153
0154 XERCES_CPP_NAMESPACE_END
0155
0156 #endif
0157