00001
00002
00003 #if !defined(XERCESC_INCLUDE_GUARD_ERRHEADER_XMLErrs)
00004 #define XERCESC_INCLUDE_GUARD_ERRHEADER_XMLErrs
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 XMLErrs
00013 {
00014 public :
00015 enum Codes
00016 {
00017 NoError = 0
00018 , W_LowBounds = 1
00019 , NotationAlreadyExists = 2
00020 , AttListAlreadyExists = 3
00021 , ContradictoryEncoding = 4
00022 , UndeclaredElemInCM = 5
00023 , UndeclaredElemInAttList = 6
00024 , XMLException_Warning = 7
00025 , XIncludeResourceErrorWarning = 8
00026 , XIncludeCannotOpenFile = 9
00027 , XIncludeIncludeFailedResourceError = 10
00028 , W_HighBounds = 11
00029 , E_LowBounds = 12
00030 , FeatureUnsupported = 13
00031 , TopLevelNoNameComplexType = 14
00032 , TopLevelNoNameAttribute = 15
00033 , NoNameRefAttribute = 16
00034 , NoNameRefElement = 17
00035 , NoNameRefGroup = 18
00036 , NoNameRefAttGroup = 19
00037 , AnonComplexTypeWithName = 20
00038 , AnonSimpleTypeWithName = 21
00039 , InvalidElementContent = 22
00040 , SimpleTypeContentError = 23
00041 , ExpectedSimpleTypeInList = 24
00042 , ListUnionRestrictionError = 25
00043 , SimpleTypeDerivationByListError = 26
00044 , ExpectedSimpleTypeInRestriction = 27
00045 , DuplicateFacet = 28
00046 , ExpectedSimpleTypeInUnion = 29
00047 , EmptySimpleTypeContent = 30
00048 , InvalidSimpleContent = 31
00049 , UnspecifiedBase = 32
00050 , InvalidComplexContent = 33
00051 , SchemaElementContentError = 34
00052 , ContentError = 35
00053 , UnknownSimpleType = 36
00054 , UnknownComplexType = 37
00055 , UnresolvedPrefix = 38
00056 , RefElementNotFound = 39
00057 , TypeNotFound = 40
00058 , TopLevelAttributeNotFound = 41
00059 , InvalidChildInComplexType = 42
00060 , BaseTypeNotFound = 43
00061 , DatatypeValidatorCreationError = 44
00062 , InvalidChildFollowingSimpleContent = 45
00063 , InvalidChildFollowingConplexContent = 46
00064 , AttributeDefaultFixedValue = 47
00065 , NotOptionalDefaultAttValue = 48
00066 , DuplicateAttribute = 49
00067 , AttributeWithTypeAndSimpleType = 50
00068 , AttributeSimpleTypeNotFound = 51
00069 , ElementWithFixedAndDefault = 52
00070 , InvalidDeclarationName = 53
00071 , ElementWithTypeAndAnonType = 54
00072 , NotSimpleOrMixedElement = 55
00073 , DisallowedSimpleTypeExtension = 56
00074 , InvalidSimpleContentBase = 57
00075 , InvalidComplexTypeBase = 58
00076 , InvalidChildInSimpleContent = 59
00077 , InvalidChildInComplexContent = 60
00078 , AnnotationError = 61
00079 , DisallowedBaseDerivation = 62
00080 , SubstitutionRepeated = 63
00081 , UnionRepeated = 64
00082 , ExtensionRepeated = 65
00083 , ListRepeated = 66
00084 , RestrictionRepeated = 67
00085 , InvalidBlockValue = 68
00086 , InvalidFinalValue = 69
00087 , InvalidSubstitutionGroupElement = 70
00088 , SubstitutionGroupTypeMismatch = 71
00089 , DuplicateElementDeclaration = 72
00090 , InvalidAttValue = 73
00091 , AttributeRefContentError = 74
00092 , DuplicateRefAttribute = 75
00093 , ForbiddenDerivationByRestriction = 76
00094 , ForbiddenDerivationByExtension = 77
00095 , BaseNotComplexType = 78
00096 , ImportNamespaceDifference = 79
00097 , DeclarationNoSchemaLocation = 80
00098 , IncludeNamespaceDifference = 81
00099 , OnlyAnnotationExpected = 82
00100 , InvalidAttributeContent = 83
00101 , AttributeRequiredGlobal = 84
00102 , AttributeRequiredLocal = 85
00103 , AttributeDisallowedGlobal = 86
00104 , AttributeDisallowedLocal = 87
00105 , InvalidMin2MaxOccurs = 88
00106 , AnyAttributeContentError = 89
00107 , NoNameGlobalElement = 90
00108 , NoCircularDefinition = 91
00109 , DuplicateGlobalType = 92
00110 , DuplicateGlobalDeclaration = 93
00111 , WS_CollapseExpected = 94
00112 , Import_1_1 = 95
00113 , Import_1_2 = 96
00114 , ElemIDValueConstraint = 97
00115 , NoNotationType = 98
00116 , EmptiableMixedContent = 99
00117 , EmptyComplexRestrictionDerivation = 100
00118 , MixedOrElementOnly = 101
00119 , InvalidContentRestriction = 102
00120 , ForbiddenDerivation = 103
00121 , AtomicItemType = 104
00122 , GroupContentError = 105
00123 , AttGroupContentError = 106
00124 , MinMaxOnGroupChild = 107
00125 , DeclarationNotFound = 108
00126 , AllContentLimited = 109
00127 , BadMinMaxAllCT = 110
00128 , BadMinMaxAllElem = 111
00129 , DuplicateAttInDerivation = 112
00130 , NotExpressibleWildCardIntersection = 113
00131 , BadAttDerivation_1 = 114
00132 , BadAttDerivation_2 = 115
00133 , BadAttDerivation_3 = 116
00134 , BadAttDerivation_4 = 117
00135 , BadAttDerivation_5 = 118
00136 , BadAttDerivation_6 = 119
00137 , BadAttDerivation_7 = 120
00138 , BadAttDerivation_8 = 121
00139 , BadAttDerivation_9 = 122
00140 , AllContentError = 123
00141 , RedefineNamespaceDifference = 124
00142 , Redefine_InvalidSimpleType = 125
00143 , Redefine_InvalidSimpleTypeBase = 126
00144 , Redefine_InvalidComplexType = 127
00145 , Redefine_InvalidComplexTypeBase = 128
00146 , Redefine_InvalidGroupMinMax = 129
00147 , Redefine_DeclarationNotFound = 130
00148 , Redefine_GroupRefCount = 131
00149 , Redefine_AttGroupRefCount = 132
00150 , Redefine_InvalidChild = 133
00151 , Notation_DeclNotFound = 134
00152 , IC_DuplicateDecl = 135
00153 , IC_BadContent = 136
00154 , IC_KeyRefReferNotFound = 137
00155 , IC_KeyRefCardinality = 138
00156 , IC_XPathExprMissing = 139
00157 , AttUseCorrect = 140
00158 , AttDeclPropCorrect3 = 141
00159 , AttDeclPropCorrect5 = 142
00160 , AttGrpPropCorrect3 = 143
00161 , InvalidTargetNSValue = 144
00162 , XMLException_Error = 145
00163 , InvalidRedefine = 146
00164 , InvalidNSReference = 147
00165 , NotAllContent = 148
00166 , InvalidAnnotationContent = 149
00167 , InvalidFacetName = 150
00168 , InvalidXMLSchemaRoot = 151
00169 , CircularSubsGroup = 152
00170 , ELTSchemaNS = 153
00171 , InvalidAttTNS = 154
00172 , NSDeclInvalid = 155
00173 , DOMLevel1Node = 156
00174 , E_HighBounds = 157
00175 , F_LowBounds = 158
00176 , EntityExpansionLimitExceeded = 159
00177 , ExpectedCommentOrCDATA = 160
00178 , ExpectedAttrName = 161
00179 , ExpectedNotationName = 162
00180 , NoRepInMixed = 163
00181 , ExpectedDefAttrDecl = 164
00182 , ExpectedEqSign = 165
00183 , ExpectedElementName = 166
00184 , CommentsMustStartWith = 167
00185 , InvalidDocumentStructure = 168
00186 , ExpectedDeclString = 169
00187 , BadXMLVersion = 170
00188 , UnsupportedXMLVersion = 171
00189 , UnterminatedXMLDecl = 172
00190 , BadXMLEncoding = 173
00191 , BadStandalone = 174
00192 , UnterminatedComment = 175
00193 , PINameExpected = 176
00194 , UnterminatedPI = 177
00195 , InvalidCharacter = 178
00196 , UnterminatedStartTag = 179
00197 , ExpectedAttrValue = 180
00198 , UnterminatedEndTag = 181
00199 , ExpectedAttributeType = 182
00200 , ExpectedEndOfTagX = 183
00201 , ExpectedMarkup = 184
00202 , NotValidAfterContent = 185
00203 , ExpectedComment = 186
00204 , ExpectedCommentOrPI = 187
00205 , ExpectedWhitespace = 188
00206 , NoRootElemInDOCTYPE = 189
00207 , ExpectedQuotedString = 190
00208 , ExpectedPublicId = 191
00209 , InvalidPublicIdChar = 192
00210 , UnterminatedDOCTYPE = 193
00211 , InvalidCharacterInIntSubset = 194
00212 , UnexpectedWhitespace = 195
00213 , InvalidCharacterInAttrValue = 196
00214 , ExpectedMarkupDecl = 197
00215 , TextDeclNotLegalHere = 198
00216 , ConditionalSectInIntSubset = 199
00217 , ExpectedPEName = 200
00218 , UnterminatedEntityDecl = 201
00219 , InvalidCharacterRef = 202
00220 , UnterminatedCharRef = 203
00221 , ExpectedEntityRefName = 204
00222 , EntityNotFound = 205
00223 , NoUnparsedEntityRefs = 206
00224 , UnterminatedEntityRef = 207
00225 , RecursiveEntity = 208
00226 , PartialMarkupInEntity = 209
00227 , UnterminatedElementDecl = 210
00228 , ExpectedContentSpecExpr = 211
00229 , ExpectedAsterisk = 212
00230 , UnterminatedContentModel = 213
00231 , ExpectedSystemOrPublicId = 214
00232 , UnterminatedNotationDecl = 215
00233 , ExpectedSeqChoiceLeaf = 216
00234 , ExpectedChoiceOrCloseParen = 217
00235 , ExpectedSeqOrCloseParen = 218
00236 , ExpectedEnumValue = 219
00237 , ExpectedEnumSepOrParen = 220
00238 , UnterminatedEntityLiteral = 221
00239 , MoreEndThanStartTags = 222
00240 , ExpectedOpenParen = 223
00241 , AttrAlreadyUsedInSTag = 224
00242 , BracketInAttrValue = 225
00243 , Expected2ndSurrogateChar = 226
00244 , ExpectedEndOfConditional = 227
00245 , ExpectedIncOrIgn = 228
00246 , ExpectedINCLUDEBracket = 229
00247 , UnexpectedEOE = 230
00248 , PEPropogated = 231
00249 , ExtraCloseSquare = 232
00250 , PERefInMarkupInIntSubset = 233
00251 , EntityPropogated = 234
00252 , ExpectedNumericalCharRef = 235
00253 , ExpectedOpenSquareBracket = 236
00254 , BadSequenceInCharData = 237
00255 , IllegalSequenceInComment = 238
00256 , UnterminatedCDATASection = 239
00257 , ExpectedNDATA = 240
00258 , NDATANotValidForPE = 241
00259 , HexRadixMustBeLowerCase = 242
00260 , DeclStringRep = 243
00261 , DeclStringsInWrongOrder = 244
00262 , NoExtRefsInAttValue = 245
00263 , XMLDeclMustBeLowerCase = 246
00264 , ExpectedEntityValue = 247
00265 , BadDigitForRadix = 248
00266 , EndedWithTagsOnStack = 249
00267 , NestedCDATA = 250
00268 , UnknownPrefix = 251
00269 , PartialTagMarkupError = 252
00270 , EmptyMainEntity = 253
00271 , CDATAOutsideOfContent = 254
00272 , Unexpected2ndSurrogateChar = 255
00273 , NoPIStartsWithXML = 256
00274 , XMLDeclMustBeFirst = 257
00275 , XMLVersionRequired = 258
00276 , StandaloneNotLegal = 259
00277 , EncodingRequired = 260
00278 , ColonNotLegalWithNS = 261
00279 , XMLException_Fatal = 262
00280 , BadSchemaLocation = 263
00281 , SchemaScanFatalError = 264
00282 , IllegalRefInStandalone = 265
00283 , PEBetweenDecl = 266
00284 , NoEmptyStrNamespace = 267
00285 , NoUseOfxmlnsAsPrefix = 268
00286 , NoUseOfxmlnsURI = 269
00287 , PrefixXMLNotMatchXMLURI = 270
00288 , XMLURINotMatchXMLPrefix = 271
00289 , NoXMLNSAsElementPrefix = 272
00290 , CT_SimpleTypeChildRequired = 273
00291 , InvalidRootElemInDOCTYPE = 274
00292 , InvalidElementName = 275
00293 , InvalidAttrName = 276
00294 , InvalidEntityRefName = 277
00295 , DuplicateDocTypeDecl = 278
00296 , XIncludeOrphanFallback = 279
00297 , XIncludeNoHref = 280
00298 , XIncludeXPointerNotSupported = 281
00299 , XIncludeInvalidParseVal = 282
00300 , XIncludeMultipleFallbackElems = 283
00301 , XIncludeIncludeFailedNoFallback = 284
00302 , XIncludeCircularInclusionLoop = 285
00303 , XIncludeCircularInclusionDocIncludesSelf = 286
00304 , XIncludeDisallowedChild = 287
00305 , XIncludeConflictingNotation = 288
00306 , XIncludeConflictingEntity = 289
00307 , F_HighBounds = 290
00308 };
00309
00310 static bool isFatal(const XMLErrs::Codes toCheck)
00311 {
00312 return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));
00313 }
00314
00315 static bool isWarning(const XMLErrs::Codes toCheck)
00316 {
00317 return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
00318 }
00319
00320 static bool isError(const XMLErrs::Codes toCheck)
00321 {
00322 return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
00323 }
00324
00325 static XMLErrorReporter::ErrTypes errorType(const XMLErrs::Codes toCheck)
00326 {
00327 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
00328 return XMLErrorReporter::ErrType_Warning;
00329 else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
00330 return XMLErrorReporter::ErrType_Fatal;
00331 else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
00332 return XMLErrorReporter::ErrType_Error;
00333 return XMLErrorReporter::ErrTypes_Unknown;
00334 }
00335 static DOMError::ErrorSeverity DOMErrorType(const XMLErrs::Codes toCheck)
00336 {
00337 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
00338 return DOMError::DOM_SEVERITY_WARNING;
00339 else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
00340 return DOMError::DOM_SEVERITY_FATAL_ERROR;
00341 else return DOMError::DOM_SEVERITY_ERROR;
00342 }
00343
00344 private:
00345
00346
00347
00348 XMLErrs();
00349 };
00350
00351 XERCES_CPP_NAMESPACE_END
00352
00353 #endif
00354