00001
00002
00003 #if !defined(ERRHEADER_XMLValid)
00004 #define ERRHEADER_XMLValid
00005
00006 #include <xercesc/framework/XMLErrorReporter.hpp>
00007 #include <xercesc/util/XercesDefs.hpp>
00008 #include <xercesc/dom/DOMError.hpp>
00009
00010 XERCES_CPP_NAMESPACE_BEGIN
00011
00012 class XMLValid
00013 {
00014 public :
00015 enum Codes
00016 {
00017 NoError = 0
00018 , E_LowBounds = 1
00019 , ElementNotDefined = 2
00020 , AttNotDefined = 3
00021 , NotationNotDeclared = 4
00022 , RootElemNotLikeDocType = 5
00023 , RequiredAttrNotProvided = 6
00024 , ElementNotValidForContent = 7
00025 , BadIDAttrDefType = 8
00026 , InvalidEmptyAttValue = 9
00027 , ElementAlreadyExists = 10
00028 , MultipleIdAttrs = 11
00029 , ReusedIDValue = 12
00030 , IDNotDeclared = 13
00031 , UnknownNotRefAttr = 14
00032 , UndeclaredElemInDocType = 15
00033 , EmptyNotValidForContent = 16
00034 , AttNotDefinedForElement = 17
00035 , BadEntityRefAttr = 18
00036 , UnknownEntityRefAttr = 19
00037 , ColonNotValidWithNS = 20
00038 , NotEnoughElemsForCM = 21
00039 , NoCharDataInCM = 22
00040 , DoesNotMatchEnumList = 23
00041 , AttrValNotName = 24
00042 , NoMultipleValues = 25
00043 , NotSameAsFixedValue = 26
00044 , RepElemInMixed = 27
00045 , NoValidatorFor = 28
00046 , IncorrectDatatype = 29
00047 , NotADatatype = 30
00048 , TextOnlyContentWithType = 31
00049 , FeatureUnsupported = 32
00050 , NestedOnlyInElemOnly = 33
00051 , EltRefOnlyInMixedElemOnly = 34
00052 , OnlyInEltContent = 35
00053 , OrderIsAll = 36
00054 , DatatypeWithType = 37
00055 , DatatypeQualUnsupported = 38
00056 , GroupContentRestricted = 39
00057 , UnknownBaseDatatype = 40
00058 , OneOfTypeRefArchRef = 41
00059 , NoContentForRef = 42
00060 , IncorrectDefaultType = 43
00061 , IllegalAttContent = 44
00062 , ValueNotInteger = 45
00063 , DatatypeError = 46
00064 , SchemaError = 47
00065 , TypeAlreadySet = 48
00066 , ProhibitedAttributePresent = 49
00067 , IllegalXMLSpace = 50
00068 , NotBoolean = 51
00069 , NotDecimal = 52
00070 , FacetsInconsistent = 53
00071 , IllegalFacetValue = 54
00072 , IllegalDecimalFacet = 55
00073 , UnknownFacet = 56
00074 , InvalidEnumValue = 57
00075 , OutOfBounds = 58
00076 , NotAnEnumValue = 59
00077 , NotInteger = 60
00078 , IllegalIntegerFacet = 61
00079 , NotReal = 62
00080 , IllegalRealFacet = 63
00081 , ScaleLargerThanPrecision = 64
00082 , PrecisionExceeded = 65
00083 , ScaleExceeded = 66
00084 , NotFloat = 67
00085 , SchemaRootError = 68
00086 , WrongTargetNamespace = 69
00087 , SimpleTypeHasChild = 70
00088 , NoDatatypeValidatorForSimpleType = 71
00089 , GrammarNotFound = 72
00090 , DisplayErrorMessage = 73
00091 , NillNotAllowed = 74
00092 , NilAttrNotEmpty = 75
00093 , FixedDifferentFromActual = 76
00094 , NoDatatypeValidatorForAttribute = 77
00095 , GenericError = 78
00096 , ElementNotQualified = 79
00097 , ElementNotUnQualified = 80
00098 , VC_IllegalRefInStandalone = 81
00099 , NoDefAttForStandalone = 82
00100 , NoAttNormForStandalone = 83
00101 , NoWSForStandalone = 84
00102 , VC_EntityNotFound = 85
00103 , PartialMarkupInPE = 86
00104 , DatatypeValidationFailure = 87
00105 , UniqueParticleAttributionFail = 88
00106 , NoAbstractInXsiType = 89
00107 , NoDirectUseAbstractElement = 90
00108 , NoUseAbstractType = 91
00109 , BadXsiType = 92
00110 , NonDerivedXsiType = 93
00111 , NoSubforBlock = 94
00112 , AttributeNotQualified = 95
00113 , AttributeNotUnQualified = 96
00114 , IC_FieldMultipleMatch = 97
00115 , IC_UnknownField = 98
00116 , IC_AbsentKeyValue = 99
00117 , IC_UniqueNotEnoughValues = 100
00118 , IC_KeyNotEnoughValues = 101
00119 , IC_KeyRefNotEnoughValues = 102
00120 , IC_KeyMatchesNillable = 103
00121 , IC_DuplicateUnique = 104
00122 , IC_DuplicateKey = 105
00123 , IC_KeyRefOutOfScope = 106
00124 , IC_KeyNotFound = 107
00125 , NonWSContent = 108
00126 , EmptyElemNotationAttr = 109
00127 , EmptyElemHasContent = 110
00128 , ElemOneNotationAttr = 111
00129 , AttrDupToken = 112
00130 , ElemChildrenHasInvalidWS = 113
00131 , E_HighBounds = 114
00132 , W_LowBounds = 115
00133 , W_HighBounds = 116
00134 , F_LowBounds = 117
00135 , F_HighBounds = 118
00136 };
00137
00138 static bool isFatal(const XMLValid::Codes toCheck)
00139 {
00140 return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));
00141 }
00142
00143 static bool isWarning(const XMLValid::Codes toCheck)
00144 {
00145 return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
00146 }
00147
00148 static bool isError(const XMLValid::Codes toCheck)
00149 {
00150 return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
00151 }
00152
00153 static XMLErrorReporter::ErrTypes errorType(const XMLValid::Codes toCheck)
00154 {
00155 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
00156 return XMLErrorReporter::ErrType_Warning;
00157 else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
00158 return XMLErrorReporter::ErrType_Fatal;
00159 else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
00160 return XMLErrorReporter::ErrType_Error;
00161 return XMLErrorReporter::ErrTypes_Unknown;
00162 }
00163 static DOMError::ErrorSeverity DOMErrorType(const XMLValid::Codes toCheck)
00164 {
00165 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
00166 return DOMError::DOM_SEVERITY_WARNING;
00167 else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
00168 return DOMError::DOM_SEVERITY_FATAL_ERROR;
00169 else return DOMError::DOM_SEVERITY_ERROR;
00170 }
00171
00172 private:
00173
00174
00175
00176 XMLValid();
00177 };
00178
00179 XERCES_CPP_NAMESPACE_END
00180
00181 #endif
00182