0

私はVB.NETで作業しています-C#の回答は問題ありません。

特定のXmlSchemaに対するXMLの検証を処理するためのシステムを構築しています。XMLドキュメントのエラーごとにSchemaExceptionのインスタンスがあり、そこからエラーの行番号と位置、およびメッセージを取得できます。私の知る限り、特定のエラー(無効な属性、欠落している要素など)を判別する唯一の方法は、MSが将来変更し、メッセージがローカライズされる可能性があるため、信頼できないメッセージ文字列を読み取ることです。

独自のカスタムエラーを表示し、テキストエディタ内でエラーを強調表示するには、.Messageプロパティに依存せずにこれらのエラーを区別できる必要があります。

これらを区別する正しい方法は何ですか?それは可能でなければなりませんよね?

より詳しい情報:

例外のLinePositionプロパティは、強調表示を開始したい位置を常に報告するわけではありません。たとえば、すべての属性関連の例外は、属性の開始を報告します。それが属性値である場合は、属性値のみを強調表示できるようにします。問題。

SchemaExceptionはSourceSchemaObjectプロパティを提供します。これを使用して、問題の原因が要素なのか属性なのかを判断できます。運が良ければ、XMLテキストを抽出して正確なエラーを特定できる可能性があります。エラーとそれを何らかの方法でSourceSchemaObjectと比較しますが、それは非常に複雑でハッキーな解決策のように感じます-特定のエラーを解決できれば、少しの正規表現作業で問題なく実行できます。

4

3 に答える 3

5

わかりました、私は最終的にこれを解決しました。メッセージを生成するには、例外に特定のエラーを示す内部値が必要であると考えたため、ILSpyを使用してその魂を深く見つめました。実際、リフレクションを使用してアクセスできるエラーにマップする文字列を保持する「res」と呼ばれる内部フィールドがあります。

このエラーを文字列として取得する小さな拡張メソッドを作成しました。

<Extension()>
Public Function getErrorType(ByRef ref As XmlSchemaException) As XmlSchemaExceptionErrorType
        Return GetType(XmlSchemaException).GetField("res", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance).GetValue(ref)
End Function 

これは素晴らしいことでしたが、Select Caseシナリオでこれらの文字列をすべて覚えておく必要はなかったので、ILSpyを使用して抽出したソースを列挙型に変換するスクリプトを作成し、次のように拡張メソッドを書き直しました。

<Extension()>
Public Function getErrorType(ByRef ref As XmlSchemaException) As XmlSchemaExceptionErrorType
    Dim res As String = GetType(XmlSchemaException).GetField("res", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance).GetValue(ref)
    Return CType(System.Enum.Parse(GetType(XmlSchemaExceptionErrorType), res), XmlSchemaExceptionErrorType)
End Function

Public Enum XmlSchemaExceptionErrorType As Integer
        Sch_ParEntityRefNesting = 0
        Sch_NotTokenString = 1
        Sch_XsdDateTimeCompare = 2
        Sch_InvalidNullCast = 3
        Sch_InvalidDateTimeOption = 4
        Sch_StandAloneNormalization = 5
        Sch_UnSpecifiedDefaultAttributeInExternalStandalone = 6
        Sch_DefaultException = 7
        Sch_DupElementDecl = 8
        Sch_IdAttrDeclared = 9
        Sch_RootMatchDocType = 10
        Sch_DupId = 11
        Sch_UndeclaredElement = 12
        Sch_UndeclaredAttribute = 13
        Sch_UndeclaredNotation = 14
        Sch_UndeclaredId = 15
        Sch_SchemaRootExpected = 16
        Sch_XSDSchemaRootExpected = 17
        Sch_UnsupportedAttribute = 18
        Sch_UnsupportedElement = 19
        Sch_MissAttribute = 20
        Sch_AnnotationLocation = 21
        Sch_DataTypeTextOnly = 22
        Sch_UnknownModel = 23
        Sch_UnknownOrder = 24
        Sch_UnknownContent = 25
        Sch_UnknownRequired = 26
        Sch_UnknownDtType = 27
        Sch_MixedMany = 28
        Sch_GroupDisabled = 29
        Sch_MissDtvalue = 30
        Sch_MissDtvaluesAttribute = 31
        Sch_DupDtType = 32
        Sch_DupAttribute = 33
        Sch_RequireEnumeration = 34
        Sch_DefaultIdValue = 35
        Sch_ElementNotAllowed = 36
        Sch_ElementMissing = 37
        Sch_ManyMaxOccurs = 38
        Sch_MaxOccursInvalid = 39
        Sch_MinOccursInvalid = 40
        Sch_DtMaxLengthInvalid = 41
        Sch_DtMinLengthInvalid = 42
        Sch_DupDtMaxLength = 43
        Sch_DupDtMinLength = 44
        Sch_DtMinMaxLength = 45
        Sch_DupElement = 46
        Sch_DupGroupParticle = 47
        Sch_InvalidValue = 48
        Sch_InvalidValueDetailed = 49
        Sch_InvalidValueDetailedAttribute = 50
        Sch_MissRequiredAttribute = 51
        Sch_FixedAttributeValue = 52
        Sch_FixedElementValue = 53
        Sch_AttributeValueDataTypeDetailed = 54
        Sch_AttributeDefaultDataType = 55
        Sch_IncludeLocation = 56
        Sch_ImportLocation = 57
        Sch_RedefineLocation = 58
        Sch_InvalidBlockDefaultValue = 59
        Sch_InvalidFinalDefaultValue = 60
        Sch_InvalidElementBlockValue = 61
        Sch_InvalidElementFinalValue = 62
        Sch_InvalidSimpleTypeFinalValue = 63
        Sch_InvalidComplexTypeBlockValue = 64
        Sch_InvalidComplexTypeFinalValue = 65
        Sch_DupIdentityConstraint = 66
        Sch_DupGlobalElement = 67
        Sch_DupGlobalAttribute = 68
        Sch_DupSimpleType = 69
        Sch_DupComplexType = 70
        Sch_DupGroup = 71
        Sch_DupAttributeGroup = 72
        Sch_DupNotation = 73
        Sch_DefaultFixedAttributes = 74
        Sch_FixedInRef = 75
        Sch_FixedDefaultInRef = 76
        Sch_DupXsdElement = 77
        Sch_ForbiddenAttribute = 78
        Sch_AttributeIgnored = 79
        Sch_ElementRef = 80
        Sch_TypeMutualExclusive = 81
        Sch_ElementNameRef = 82
        Sch_AttributeNameRef = 83
        Sch_TextNotAllowed = 84
        Sch_UndeclaredType = 85
        Sch_UndeclaredSimpleType = 86
        Sch_UndeclaredEquivClass = 87
        Sch_AttListPresence = 88
        Sch_NotationValue = 89
        Sch_EnumerationValue = 90
        Sch_EmptyAttributeValue = 91
        Sch_InvalidLanguageId = 92
        Sch_XmlSpace = 93
        Sch_InvalidXsdAttributeValue = 94
        Sch_InvalidXsdAttributeDatatypeValue = 95
        Sch_ElementValueDataTypeDetailed = 96
        Sch_InvalidElementDefaultValue = 97
        Sch_NonDeterministic = 98
        Sch_NonDeterministicAnyEx = 99
        Sch_NonDeterministicAnyAny = 100
        Sch_StandAlone = 101
        Sch_XmlNsAttribute = 102
        Sch_AllElement = 103
        Sch_MismatchTargetNamespaceInclude = 104
        Sch_MismatchTargetNamespaceImport = 105
        Sch_MismatchTargetNamespaceEx = 106
        Sch_XsiTypeNotFound = 107
        Sch_XsiTypeAbstract = 108
        Sch_ListFromNonatomic = 109
        Sch_UnionFromUnion = 110
        Sch_DupLengthFacet = 111
        Sch_DupMinLengthFacet = 112
        Sch_DupMaxLengthFacet = 113
        Sch_DupWhiteSpaceFacet = 114
        Sch_DupMaxInclusiveFacet = 115
        Sch_DupMaxExclusiveFacet = 116
        Sch_DupMinInclusiveFacet = 117
        Sch_DupMinExclusiveFacet = 118
        Sch_DupTotalDigitsFacet = 119
        Sch_DupFractionDigitsFacet = 120
        Sch_LengthFacetProhibited = 121
        Sch_MinLengthFacetProhibited = 122
        Sch_MaxLengthFacetProhibited = 123
        Sch_PatternFacetProhibited = 124
        Sch_EnumerationFacetProhibited = 125
        Sch_WhiteSpaceFacetProhibited = 126
        Sch_MaxInclusiveFacetProhibited = 127
        Sch_MaxExclusiveFacetProhibited = 128
        Sch_MinInclusiveFacetProhibited = 129
        Sch_MinExclusiveFacetProhibited = 130
        Sch_TotalDigitsFacetProhibited = 131
        Sch_FractionDigitsFacetProhibited = 132
        Sch_LengthFacetInvalid = 133
        Sch_MinLengthFacetInvalid = 134
        Sch_MaxLengthFacetInvalid = 135
        Sch_MaxInclusiveFacetInvalid = 136
        Sch_MaxExclusiveFacetInvalid = 137
        Sch_MinInclusiveFacetInvalid = 138
        Sch_MinExclusiveFacetInvalid = 139
        Sch_TotalDigitsFacetInvalid = 140
        Sch_FractionDigitsFacetInvalid = 141
        Sch_PatternFacetInvalid = 142
        Sch_EnumerationFacetInvalid = 143
        Sch_InvalidWhiteSpace = 144
        Sch_UnknownFacet = 145
        Sch_LengthAndMinMax = 146
        Sch_MinLengthGtMaxLength = 147
        Sch_FractionDigitsGtTotalDigits = 148
        Sch_LengthConstraintFailed = 149
        Sch_MinLengthConstraintFailed = 150
        Sch_MaxLengthConstraintFailed = 151
        Sch_PatternConstraintFailed = 152
        Sch_EnumerationConstraintFailed = 153
        Sch_MaxInclusiveConstraintFailed = 154
        Sch_MaxExclusiveConstraintFailed = 155
        Sch_MinInclusiveConstraintFailed = 156
        Sch_MinExclusiveConstraintFailed = 157
        Sch_TotalDigitsConstraintFailed = 158
        Sch_FractionDigitsConstraintFailed = 159
        Sch_UnionFailedEx = 160
        Sch_NotationRequired = 161
        Sch_DupNotationAttribute = 162
        Sch_MissingPublicSystemAttribute = 163
        Sch_NotationAttributeOnEmptyElement = 164
        Sch_RefNotInScope = 165
        Sch_UndeclaredIdentityConstraint = 166
        Sch_RefInvalidIdentityConstraint = 167
        Sch_RefInvalidCardin = 168
        Sch_ReftoKeyref = 169
        Sch_EmptyXPath = 170
        Sch_UnresolvedPrefix = 171
        Sch_UnresolvedKeyref = 172
        Sch_ICXpathError = 173
        Sch_SelectorAttr = 174
        Sch_FieldSimpleTypeExpected = 175
        Sch_FieldSingleValueExpected = 176
        Sch_MissingKey = 177
        Sch_DuplicateKey = 178
        Sch_TargetNamespaceXsi = 179
        Sch_UndeclaredEntity = 180
        Sch_UnparsedEntityRef = 181
        Sch_MaxOccursInvalidXsd = 182
        Sch_MinOccursInvalidXsd = 183
        Sch_MaxInclusiveExclusive = 184
        Sch_MinInclusiveExclusive = 185
        Sch_MinInclusiveGtMaxInclusive = 186
        Sch_MinExclusiveGtMaxExclusive = 187
        Sch_MinInclusiveGtMaxExclusive = 188
        Sch_MinExclusiveGtMaxInclusive = 189
        Sch_SimpleTypeRestriction = 190
        Sch_InvalidFacetPosition = 191
        Sch_AttributeMutuallyExclusive = 192
        Sch_AnyAttributeLastChild = 193
        Sch_ComplexTypeContentModel = 194
        Sch_ComplexContentContentModel = 195
        Sch_NotNormalizedString = 196
        Sch_FractionDigitsNotOnDecimal = 197
        Sch_ContentInNill = 198
        Sch_NoElementSchemaFound = 199
        Sch_NoAttributeSchemaFound = 200
        Sch_InvalidNamespace = 201
        Sch_InvalidTargetNamespaceAttribute = 202
        Sch_InvalidNamespaceAttribute = 203
        Sch_InvalidSchemaLocation = 204
        Sch_ImportTargetNamespace = 205
        Sch_ImportTargetNamespaceNull = 206
        Sch_GroupDoubleRedefine = 207
        Sch_ComponentRedefineNotFound = 208
        Sch_GroupRedefineNotFound = 209
        Sch_AttrGroupDoubleRedefine = 210
        Sch_AttrGroupRedefineNotFound = 211
        Sch_ComplexTypeDoubleRedefine = 212
        Sch_ComplexTypeRedefineNotFound = 213
        Sch_SimpleToComplexTypeRedefine = 214
        Sch_SimpleTypeDoubleRedefine = 215
        Sch_ComplexToSimpleTypeRedefine = 216
        Sch_SimpleTypeRedefineNotFound = 217
        Sch_MinMaxGroupRedefine = 218
        Sch_MultipleGroupSelfRef = 219
        Sch_MultipleAttrGroupSelfRef = 220
        Sch_InvalidTypeRedefine = 221
        Sch_InvalidElementRef = 222
        Sch_MinGtMax = 223
        Sch_DupSelector = 224
        Sch_IdConstraintNoSelector = 225
        Sch_IdConstraintNoFields = 226
        Sch_IdConstraintNoRefer = 227
        Sch_SelectorBeforeFields = 228
        Sch_NoSimpleTypeContent = 229
        Sch_SimpleTypeRestRefBase = 230
        Sch_SimpleTypeRestRefBaseNone = 231
        Sch_SimpleTypeListRefBase = 232
        Sch_SimpleTypeListRefBaseNone = 233
        Sch_SimpleTypeUnionNoBase = 234
        Sch_NoRestOrExtQName = 235
        Sch_NoRestOrExt = 236
        Sch_NoGroupParticle = 237
        Sch_InvalidAllMin = 238
        Sch_InvalidAllMax = 239
        Sch_InvalidFacet = 240
        Sch_AbstractElement = 241
        Sch_XsiTypeBlockedEx = 242
        Sch_InvalidXsiNill = 243
        Sch_SubstitutionNotAllowed = 244
        Sch_SubstitutionBlocked = 245
        Sch_InvalidElementInEmptyEx = 246
        Sch_InvalidElementInTextOnlyEx = 247
        Sch_InvalidTextInElement = 248
        Sch_InvalidElementContent = 249
        Sch_InvalidElementContentComplex = 250
        Sch_IncompleteContent = 251
        Sch_IncompleteContentComplex = 252
        Sch_InvalidTextInElementExpecting = 253
        Sch_InvalidElementContentExpecting = 254
        Sch_InvalidElementContentExpectingComplex = 255
        Sch_IncompleteContentExpecting = 256
        Sch_IncompleteContentExpectingComplex = 257
        Sch_InvalidElementSubstitution = 258
        Sch_ElementNameAndNamespace = 259
        Sch_ElementName = 260
        Sch_ContinuationString = 261
        Sch_AnyElementNS = 262
        Sch_AnyElement = 263
        Sch_InvalidTextInEmpty = 264
        Sch_InvalidWhitespaceInEmpty = 265
        Sch_InvalidPIComment = 266
        Sch_InvalidAttributeRef = 267
        Sch_OptionalDefaultAttribute = 268
        Sch_AttributeCircularRef = 269
        Sch_IdentityConstraintCircularRef = 270
        Sch_SubstitutionCircularRef = 271
        Sch_InvalidAnyAttribute = 272
        Sch_DupIdAttribute = 273
        Sch_InvalidAllElementMax = 274
        Sch_InvalidAny = 275
        Sch_InvalidAnyDetailed = 276
        Sch_InvalidExamplar = 277
        Sch_NoExamplar = 278
        Sch_InvalidSubstitutionMember = 279
        Sch_RedefineNoSchema = 280
        Sch_ProhibitedAttribute = 281
        Sch_TypeCircularRef = 282
        Sch_TwoIdAttrUses = 283
        Sch_AttrUseAndWildId = 284
        Sch_MoreThanOneWildId = 285
        Sch_BaseFinalExtension = 286
        Sch_NotSimpleContent = 287
        Sch_NotComplexContent = 288
        Sch_BaseFinalRestriction = 289
        Sch_BaseFinalList = 290
        Sch_BaseFinalUnion = 291
        Sch_UndefBaseRestriction = 292
        Sch_UndefBaseExtension = 293
        Sch_DifContentType = 294
        Sch_InvalidContentRestriction = 295
        Sch_InvalidContentRestrictionDetailed = 296
        Sch_InvalidBaseToEmpty = 297
        Sch_InvalidBaseToMixed = 298
        Sch_DupAttributeUse = 299
        Sch_InvalidParticleRestriction = 300
        Sch_InvalidParticleRestrictionDetailed = 301
        Sch_ForbiddenDerivedParticleForAll = 302
        Sch_ForbiddenDerivedParticleForElem = 303
        Sch_ForbiddenDerivedParticleForChoice = 304
        Sch_ForbiddenDerivedParticleForSeq = 305
        Sch_ElementFromElement = 306
        Sch_ElementFromAnyRule1 = 307
        Sch_ElementFromAnyRule2 = 308
        Sch_AnyFromAnyRule1 = 309
        Sch_AnyFromAnyRule2 = 310
        Sch_AnyFromAnyRule3 = 311
        Sch_GroupBaseFromAny1 = 312
        Sch_GroupBaseFromAny2 = 313
        Sch_ElementFromGroupBase1 = 314
        Sch_ElementFromGroupBase2 = 315
        Sch_ElementFromGroupBase3 = 316
        Sch_GroupBaseRestRangeInvalid = 317
        Sch_GroupBaseRestNoMap = 318
        Sch_GroupBaseRestNotEmptiable = 319
        Sch_SeqFromAll = 320
        Sch_SeqFromChoice = 321
        Sch_UndefGroupRef = 322
        Sch_GroupCircularRef = 323
        Sch_AllRefNotRoot = 324
        Sch_AllRefMinMax = 325
        Sch_NotAllAlone = 326
        Sch_AttributeGroupCircularRef = 327
        Sch_UndefAttributeGroupRef = 328
        Sch_InvalidAttributeExtension = 329
        Sch_InvalidAnyAttributeRestriction = 330
        Sch_AttributeRestrictionProhibited = 331
        Sch_AttributeRestrictionInvalid = 332
        Sch_AttributeFixedInvalid = 333
        Sch_AttributeUseInvalid = 334
        Sch_AttributeRestrictionInvalidFromWildcard = 335
        Sch_NoDerivedAttribute = 336
        Sch_UnexpressibleAnyAttribute = 337
        Sch_RefInvalidAttribute = 338
        Sch_ElementCircularRef = 339
        Sch_RefInvalidElement = 340
        Sch_ElementCannotHaveValue = 341
        Sch_ElementInMixedWithFixed = 342
        Sch_ElementTypeCollision = 343
        Sch_InvalidIncludeLocation = 344
        Sch_CannotLoadSchema = 345
        Sch_CannotLoadSchemaLocation = 346
        Sch_LengthGtBaseLength = 347
        Sch_MinLengthGtBaseMinLength = 348
        Sch_MaxLengthGtBaseMaxLength = 349
        Sch_MaxMinLengthBaseLength = 350
        Sch_MaxInclusiveMismatch = 351
        Sch_MaxExclusiveMismatch = 352
        Sch_MinInclusiveMismatch = 353
        Sch_MinExclusiveMismatch = 354
        Sch_MinExlIncMismatch = 355
        Sch_MinExlMaxExlMismatch = 356
        Sch_MinIncMaxExlMismatch = 357
        Sch_MinIncExlMismatch = 358
        Sch_MaxIncExlMismatch = 359
        Sch_MaxExlIncMismatch = 360
        Sch_TotalDigitsMismatch = 361
        Sch_FacetBaseFixed = 362
        Sch_WhiteSpaceRestriction1 = 363
        Sch_WhiteSpaceRestriction2 = 364
        Sch_XsiNilAndFixed = 365
        Sch_MixSchemaTypes = 366
        Sch_XSDSchemaOnly = 367
        Sch_InvalidPublicAttribute = 368
        Sch_InvalidSystemAttribute = 369
        Sch_TypeAfterConstraints = 370
        Sch_XsiNilAndType = 371
        Sch_DupSimpleTypeChild = 372
        Sch_InvalidIdAttribute = 373
        Sch_InvalidNameAttributeEx = 374
        Sch_InvalidAttribute = 375
        Sch_EmptyChoice = 376
        Sch_DerivedNotFromBase = 377
        Sch_NeedSimpleTypeChild = 378
        Sch_InvalidCollection = 379
        Sch_UnrefNS = 380
        Sch_InvalidSimpleTypeRestriction = 381
        Sch_MultipleRedefine = 382
        Sch_NullValue = 383
        Sch_ComplexContentModel = 384
        Sch_SchemaNotPreprocessed = 385
        Sch_SchemaNotRemoved = 386
        Sch_ComponentAlreadySeenForNS = 387
        Sch_DefaultAttributeNotApplied = 388
        Sch_NotXsiAttribute = 389
        Sch_SchemaDoesNotExist = 390
        Sch_InvalidStartTransition = 391
        Sch_InvalidStateTransition = 392
        Sch_InvalidEndValidation = 393
        Sch_InvalidEndElementCall = 394
        Sch_InvalidEndElementCallTyped = 395
        Sch_InvalidEndElementMultiple = 396
        Sch_DuplicateAttribute = 397
        Sch_InvalidPartialValidationType = 398
        Sch_SchemaElementNameMismatch = 399
        Sch_SchemaAttributeNameMismatch = 400
        Sch_ValidateAttributeInvalidCall = 401
        Sch_ValidateElementInvalidCall = 402
        Sch_EnumNotStarted = 403
        Sch_EnumFinished = 404
        Sch_ErrorPosition = 405
        Sch_ReservedNsDecl = 406
        Sch_NotInSchemaCollection = 407
        Sch_NotationNotAttr = 408
        Sch_InvalidContent = 409
        Sch_InvalidContentExpecting = 410
        Sch_InvalidTextWhiteSpace = 411
        Sch_XSCHEMA = 412
        Sch_DubSchema = 413
        Sch_AttributeValueDataType = 414
        Sch_ElementValueDataType = 415
        Sch_NonDeterministicAny = 416
        Sch_MismatchTargetNamespace = 417
        Sch_UnionFailed = 418
        Sch_XsiTypeBlocked = 419
        Sch_InvalidElementInEmpty = 420
        Sch_InvalidElementInTextOnly = 421
        Sch_InvalidNameAttribute = 422
    End Enum

ターダー!

これで、次のようにエラー処理を実行できます。

Select Case e.Exception.getErrorType
    Case XmlSchemaExceptionErrorType.Sch_UndeclaredAttribute
        ' Error specific code
    Case XmlSchemaExceptionErrorType.Sch_UndeclaredElement
        ' Error specific code
    Case Else
        ' General code for handling any other errors we don't specifically care about
End Select
于 2012-11-30T20:38:09.213 に答える
0

xmlスキーマに対して 検証できます。

検証エラーは、XmlReaderSettings.ValidationEventHandlerイベントで処理されます。ここの例

xmlスキーマの分類法(検証ルールなど)がある場合は、入力メッセージを解析/ユーザーフレンドリーなメッセージに変換できます。

その他の非xmlエラーの場合は、xmlファイルを読み取ったり検証したりするコードに汎用のtry/catchハンドラーを追加します。

于 2012-11-28T14:53:06.637 に答える
0

SeriousSamPの答えは素晴らしいです。コードをC#に移植しました。多分それは他の誰かのために役立つでしょう。

コードを新しいクラスに追加するだけです。必要に応じて名前空間を調整します。例外タイプが必要なファイルに、を使用して名前空間を追加します。

このように呼んでください:XmlSchemaExceptionErrorType myType = myException.GetSchemaErrorType();

移植されたコードは次のとおりです。

using System.Xml.Schema;

namespace MyNamespace.ClassExtensions
{
    public static class XmlSchemaExceptionExtensions
    {

        /// <summary>
        /// Get schema error type as enum. (This is only possible by reflection.)
        /// </summary>
        public static XmlSchemaExceptionErrorType GetSchemaErrorType(this XmlSchemaException exception)
        {
            string res = typeof(XmlSchemaException).GetField("res", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(exception) as string;
            return (XmlSchemaExceptionErrorType)System.Enum.Parse(typeof(XmlSchemaExceptionErrorType), res);
        }


        /// <summary>
        /// Error type enums of XmlSchemaException.
        /// </summary>
        public enum XmlSchemaExceptionErrorType
        {
            #region long list of definitions
            Sch_ParEntityRefNesting = 0,
            Sch_NotTokenString = 1,
            Sch_XsdDateTimeCompare = 2,
            Sch_InvalidNullCast = 3,
            Sch_InvalidDateTimeOption = 4,
            Sch_StandAloneNormalization = 5,
            Sch_UnSpecifiedDefaultAttributeInExternalStandalone = 6,
            Sch_DefaultException = 7,
            Sch_DupElementDecl = 8,
            Sch_IdAttrDeclared = 9,
            Sch_RootMatchDocType = 10,
            Sch_DupId = 11,
            Sch_UndeclaredElement = 12,
            Sch_UndeclaredAttribute = 13,
            Sch_UndeclaredNotation = 14,
            Sch_UndeclaredId = 15,
            Sch_SchemaRootExpected = 16,
            Sch_XSDSchemaRootExpected = 17,
            Sch_UnsupportedAttribute = 18,
            Sch_UnsupportedElement = 19,
            Sch_MissAttribute = 20,
            Sch_AnnotationLocation = 21,
            Sch_DataTypeTextOnly = 22,
            Sch_UnknownModel = 23,
            Sch_UnknownOrder = 24,
            Sch_UnknownContent = 25,
            Sch_UnknownRequired = 26,
            Sch_UnknownDtType = 27,
            Sch_MixedMany = 28,
            Sch_GroupDisabled = 29,
            Sch_MissDtvalue = 30,
            Sch_MissDtvaluesAttribute = 31,
            Sch_DupDtType = 32,
            Sch_DupAttribute = 33,
            Sch_RequireEnumeration = 34,
            Sch_DefaultIdValue = 35,
            Sch_ElementNotAllowed = 36,
            Sch_ElementMissing = 37,
            Sch_ManyMaxOccurs = 38,
            Sch_MaxOccursInvalid = 39,
            Sch_MinOccursInvalid = 40,
            Sch_DtMaxLengthInvalid = 41,
            Sch_DtMinLengthInvalid = 42,
            Sch_DupDtMaxLength = 43,
            Sch_DupDtMinLength = 44,
            Sch_DtMinMaxLength = 45,
            Sch_DupElement = 46,
            Sch_DupGroupParticle = 47,
            Sch_InvalidValue = 48,
            Sch_InvalidValueDetailed = 49,
            Sch_InvalidValueDetailedAttribute = 50,
            Sch_MissRequiredAttribute = 51,
            Sch_FixedAttributeValue = 52,
            Sch_FixedElementValue = 53,
            Sch_AttributeValueDataTypeDetailed = 54,
            Sch_AttributeDefaultDataType = 55,
            Sch_IncludeLocation = 56,
            Sch_ImportLocation = 57,
            Sch_RedefineLocation = 58,
            Sch_InvalidBlockDefaultValue = 59,
            Sch_InvalidFinalDefaultValue = 60,
            Sch_InvalidElementBlockValue = 61,
            Sch_InvalidElementFinalValue = 62,
            Sch_InvalidSimpleTypeFinalValue = 63,
            Sch_InvalidComplexTypeBlockValue = 64,
            Sch_InvalidComplexTypeFinalValue = 65,
            Sch_DupIdentityConstraint = 66,
            Sch_DupGlobalElement = 67,
            Sch_DupGlobalAttribute = 68,
            Sch_DupSimpleType = 69,
            Sch_DupComplexType = 70,
            Sch_DupGroup = 71,
            Sch_DupAttributeGroup = 72,
            Sch_DupNotation = 73,
            Sch_DefaultFixedAttributes = 74,
            Sch_FixedInRef = 75,
            Sch_FixedDefaultInRef = 76,
            Sch_DupXsdElement = 77,
            Sch_ForbiddenAttribute = 78,
            Sch_AttributeIgnored = 79,
            Sch_ElementRef = 80,
            Sch_TypeMutualExclusive = 81,
            Sch_ElementNameRef = 82,
            Sch_AttributeNameRef = 83,
            Sch_TextNotAllowed = 84,
            Sch_UndeclaredType = 85,
            Sch_UndeclaredSimpleType = 86,
            Sch_UndeclaredEquivClass = 87,
            Sch_AttListPresence = 88,
            Sch_NotationValue = 89,
            Sch_EnumerationValue = 90,
            Sch_EmptyAttributeValue = 91,
            Sch_InvalidLanguageId = 92,
            Sch_XmlSpace = 93,
            Sch_InvalidXsdAttributeValue = 94,
            Sch_InvalidXsdAttributeDatatypeValue = 95,
            Sch_ElementValueDataTypeDetailed = 96,
            Sch_InvalidElementDefaultValue = 97,
            Sch_NonDeterministic = 98,
            Sch_NonDeterministicAnyEx = 99,
            Sch_NonDeterministicAnyAny = 100,
            Sch_StandAlone = 101,
            Sch_XmlNsAttribute = 102,
            Sch_AllElement = 103,
            Sch_MismatchTargetNamespaceInclude = 104,
            Sch_MismatchTargetNamespaceImport = 105,
            Sch_MismatchTargetNamespaceEx = 106,
            Sch_XsiTypeNotFound = 107,
            Sch_XsiTypeAbstract = 108,
            Sch_ListFromNonatomic = 109,
            Sch_UnionFromUnion = 110,
            Sch_DupLengthFacet = 111,
            Sch_DupMinLengthFacet = 112,
            Sch_DupMaxLengthFacet = 113,
            Sch_DupWhiteSpaceFacet = 114,
            Sch_DupMaxInclusiveFacet = 115,
            Sch_DupMaxExclusiveFacet = 116,
            Sch_DupMinInclusiveFacet = 117,
            Sch_DupMinExclusiveFacet = 118,
            Sch_DupTotalDigitsFacet = 119,
            Sch_DupFractionDigitsFacet = 120,
            Sch_LengthFacetProhibited = 121,
            Sch_MinLengthFacetProhibited = 122,
            Sch_MaxLengthFacetProhibited = 123,
            Sch_PatternFacetProhibited = 124,
            Sch_EnumerationFacetProhibited = 125,
            Sch_WhiteSpaceFacetProhibited = 126,
            Sch_MaxInclusiveFacetProhibited = 127,
            Sch_MaxExclusiveFacetProhibited = 128,
            Sch_MinInclusiveFacetProhibited = 129,
            Sch_MinExclusiveFacetProhibited = 130,
            Sch_TotalDigitsFacetProhibited = 131,
            Sch_FractionDigitsFacetProhibited = 132,
            Sch_LengthFacetInvalid = 133,
            Sch_MinLengthFacetInvalid = 134,
            Sch_MaxLengthFacetInvalid = 135,
            Sch_MaxInclusiveFacetInvalid = 136,
            Sch_MaxExclusiveFacetInvalid = 137,
            Sch_MinInclusiveFacetInvalid = 138,
            Sch_MinExclusiveFacetInvalid = 139,
            Sch_TotalDigitsFacetInvalid = 140,
            Sch_FractionDigitsFacetInvalid = 141,
            Sch_PatternFacetInvalid = 142,
            Sch_EnumerationFacetInvalid = 143,
            Sch_InvalidWhiteSpace = 144,
            Sch_UnknownFacet = 145,
            Sch_LengthAndMinMax = 146,
            Sch_MinLengthGtMaxLength = 147,
            Sch_FractionDigitsGtTotalDigits = 148,
            Sch_LengthConstraintFailed = 149,
            Sch_MinLengthConstraintFailed = 150,
            Sch_MaxLengthConstraintFailed = 151,
            Sch_PatternConstraintFailed = 152,
            Sch_EnumerationConstraintFailed = 153,
            Sch_MaxInclusiveConstraintFailed = 154,
            Sch_MaxExclusiveConstraintFailed = 155,
            Sch_MinInclusiveConstraintFailed = 156,
            Sch_MinExclusiveConstraintFailed = 157,
            Sch_TotalDigitsConstraintFailed = 158,
            Sch_FractionDigitsConstraintFailed = 159,
            Sch_UnionFailedEx = 160,
            Sch_NotationRequired = 161,
            Sch_DupNotationAttribute = 162,
            Sch_MissingPublicSystemAttribute = 163,
            Sch_NotationAttributeOnEmptyElement = 164,
            Sch_RefNotInScope = 165,
            Sch_UndeclaredIdentityConstraint = 166,
            Sch_RefInvalidIdentityConstraint = 167,
            Sch_RefInvalidCardin = 168,
            Sch_ReftoKeyref = 169,
            Sch_EmptyXPath = 170,
            Sch_UnresolvedPrefix = 171,
            Sch_UnresolvedKeyref = 172,
            Sch_ICXpathError = 173,
            Sch_SelectorAttr = 174,
            Sch_FieldSimpleTypeExpected = 175,
            Sch_FieldSingleValueExpected = 176,
            Sch_MissingKey = 177,
            Sch_DuplicateKey = 178,
            Sch_TargetNamespaceXsi = 179,
            Sch_UndeclaredEntity = 180,
            Sch_UnparsedEntityRef = 181,
            Sch_MaxOccursInvalidXsd = 182,
            Sch_MinOccursInvalidXsd = 183,
            Sch_MaxInclusiveExclusive = 184,
            Sch_MinInclusiveExclusive = 185,
            Sch_MinInclusiveGtMaxInclusive = 186,
            Sch_MinExclusiveGtMaxExclusive = 187,
            Sch_MinInclusiveGtMaxExclusive = 188,
            Sch_MinExclusiveGtMaxInclusive = 189,
            Sch_SimpleTypeRestriction = 190,
            Sch_InvalidFacetPosition = 191,
            Sch_AttributeMutuallyExclusive = 192,
            Sch_AnyAttributeLastChild = 193,
            Sch_ComplexTypeContentModel = 194,
            Sch_ComplexContentContentModel = 195,
            Sch_NotNormalizedString = 196,
            Sch_FractionDigitsNotOnDecimal = 197,
            Sch_ContentInNill = 198,
            Sch_NoElementSchemaFound = 199,
            Sch_NoAttributeSchemaFound = 200,
            Sch_InvalidNamespace = 201,
            Sch_InvalidTargetNamespaceAttribute = 202,
            Sch_InvalidNamespaceAttribute = 203,
            Sch_InvalidSchemaLocation = 204,
            Sch_ImportTargetNamespace = 205,
            Sch_ImportTargetNamespaceNull = 206,
            Sch_GroupDoubleRedefine = 207,
            Sch_ComponentRedefineNotFound = 208,
            Sch_GroupRedefineNotFound = 209,
            Sch_AttrGroupDoubleRedefine = 210,
            Sch_AttrGroupRedefineNotFound = 211,
            Sch_ComplexTypeDoubleRedefine = 212,
            Sch_ComplexTypeRedefineNotFound = 213,
            Sch_SimpleToComplexTypeRedefine = 214,
            Sch_SimpleTypeDoubleRedefine = 215,
            Sch_ComplexToSimpleTypeRedefine = 216,
            Sch_SimpleTypeRedefineNotFound = 217,
            Sch_MinMaxGroupRedefine = 218,
            Sch_MultipleGroupSelfRef = 219,
            Sch_MultipleAttrGroupSelfRef = 220,
            Sch_InvalidTypeRedefine = 221,
            Sch_InvalidElementRef = 222,
            Sch_MinGtMax = 223,
            Sch_DupSelector = 224,
            Sch_IdConstraintNoSelector = 225,
            Sch_IdConstraintNoFields = 226,
            Sch_IdConstraintNoRefer = 227,
            Sch_SelectorBeforeFields = 228,
            Sch_NoSimpleTypeContent = 229,
            Sch_SimpleTypeRestRefBase = 230,
            Sch_SimpleTypeRestRefBaseNone = 231,
            Sch_SimpleTypeListRefBase = 232,
            Sch_SimpleTypeListRefBaseNone = 233,
            Sch_SimpleTypeUnionNoBase = 234,
            Sch_NoRestOrExtQName = 235,
            Sch_NoRestOrExt = 236,
            Sch_NoGroupParticle = 237,
            Sch_InvalidAllMin = 238,
            Sch_InvalidAllMax = 239,
            Sch_InvalidFacet = 240,
            Sch_AbstractElement = 241,
            Sch_XsiTypeBlockedEx = 242,
            Sch_InvalidXsiNill = 243,
            Sch_SubstitutionNotAllowed = 244,
            Sch_SubstitutionBlocked = 245,
            Sch_InvalidElementInEmptyEx = 246,
            Sch_InvalidElementInTextOnlyEx = 247,
            Sch_InvalidTextInElement = 248,
            Sch_InvalidElementContent = 249,
            Sch_InvalidElementContentComplex = 250,
            Sch_IncompleteContent = 251,
            Sch_IncompleteContentComplex = 252,
            Sch_InvalidTextInElementExpecting = 253,
            Sch_InvalidElementContentExpecting = 254,
            Sch_InvalidElementContentExpectingComplex = 255,
            Sch_IncompleteContentExpecting = 256,
            Sch_IncompleteContentExpectingComplex = 257,
            Sch_InvalidElementSubstitution = 258,
            Sch_ElementNameAndNamespace = 259,
            Sch_ElementName = 260,
            Sch_ContinuationString = 261,
            Sch_AnyElementNS = 262,
            Sch_AnyElement = 263,
            Sch_InvalidTextInEmpty = 264,
            Sch_InvalidWhitespaceInEmpty = 265,
            Sch_InvalidPIComment = 266,
            Sch_InvalidAttributeRef = 267,
            Sch_OptionalDefaultAttribute = 268,
            Sch_AttributeCircularRef = 269,
            Sch_IdentityConstraintCircularRef = 270,
            Sch_SubstitutionCircularRef = 271,
            Sch_InvalidAnyAttribute = 272,
            Sch_DupIdAttribute = 273,
            Sch_InvalidAllElementMax = 274,
            Sch_InvalidAny = 275,
            Sch_InvalidAnyDetailed = 276,
            Sch_InvalidExamplar = 277,
            Sch_NoExamplar = 278,
            Sch_InvalidSubstitutionMember = 279,
            Sch_RedefineNoSchema = 280,
            Sch_ProhibitedAttribute = 281,
            Sch_TypeCircularRef = 282,
            Sch_TwoIdAttrUses = 283,
            Sch_AttrUseAndWildId = 284,
            Sch_MoreThanOneWildId = 285,
            Sch_BaseFinalExtension = 286,
            Sch_NotSimpleContent = 287,
            Sch_NotComplexContent = 288,
            Sch_BaseFinalRestriction = 289,
            Sch_BaseFinalList = 290,
            Sch_BaseFinalUnion = 291,
            Sch_UndefBaseRestriction = 292,
            Sch_UndefBaseExtension = 293,
            Sch_DifContentType = 294,
            Sch_InvalidContentRestriction = 295,
            Sch_InvalidContentRestrictionDetailed = 296,
            Sch_InvalidBaseToEmpty = 297,
            Sch_InvalidBaseToMixed = 298,
            Sch_DupAttributeUse = 299,
            Sch_InvalidParticleRestriction = 300,
            Sch_InvalidParticleRestrictionDetailed = 301,
            Sch_ForbiddenDerivedParticleForAll = 302,
            Sch_ForbiddenDerivedParticleForElem = 303,
            Sch_ForbiddenDerivedParticleForChoice = 304,
            Sch_ForbiddenDerivedParticleForSeq = 305,
            Sch_ElementFromElement = 306,
            Sch_ElementFromAnyRule1 = 307,
            Sch_ElementFromAnyRule2 = 308,
            Sch_AnyFromAnyRule1 = 309,
            Sch_AnyFromAnyRule2 = 310,
            Sch_AnyFromAnyRule3 = 311,
            Sch_GroupBaseFromAny1 = 312,
            Sch_GroupBaseFromAny2 = 313,
            Sch_ElementFromGroupBase1 = 314,
            Sch_ElementFromGroupBase2 = 315,
            Sch_ElementFromGroupBase3 = 316,
            Sch_GroupBaseRestRangeInvalid = 317,
            Sch_GroupBaseRestNoMap = 318,
            Sch_GroupBaseRestNotEmptiable = 319,
            Sch_SeqFromAll = 320,
            Sch_SeqFromChoice = 321,
            Sch_UndefGroupRef = 322,
            Sch_GroupCircularRef = 323,
            Sch_AllRefNotRoot = 324,
            Sch_AllRefMinMax = 325,
            Sch_NotAllAlone = 326,
            Sch_AttributeGroupCircularRef = 327,
            Sch_UndefAttributeGroupRef = 328,
            Sch_InvalidAttributeExtension = 329,
            Sch_InvalidAnyAttributeRestriction = 330,
            Sch_AttributeRestrictionProhibited = 331,
            Sch_AttributeRestrictionInvalid = 332,
            Sch_AttributeFixedInvalid = 333,
            Sch_AttributeUseInvalid = 334,
            Sch_AttributeRestrictionInvalidFromWildcard = 335,
            Sch_NoDerivedAttribute = 336,
            Sch_UnexpressibleAnyAttribute = 337,
            Sch_RefInvalidAttribute = 338,
            Sch_ElementCircularRef = 339,
            Sch_RefInvalidElement = 340,
            Sch_ElementCannotHaveValue = 341,
            Sch_ElementInMixedWithFixed = 342,
            Sch_ElementTypeCollision = 343,
            Sch_InvalidIncludeLocation = 344,
            Sch_CannotLoadSchema = 345,
            Sch_CannotLoadSchemaLocation = 346,
            Sch_LengthGtBaseLength = 347,
            Sch_MinLengthGtBaseMinLength = 348,
            Sch_MaxLengthGtBaseMaxLength = 349,
            Sch_MaxMinLengthBaseLength = 350,
            Sch_MaxInclusiveMismatch = 351,
            Sch_MaxExclusiveMismatch = 352,
            Sch_MinInclusiveMismatch = 353,
            Sch_MinExclusiveMismatch = 354,
            Sch_MinExlIncMismatch = 355,
            Sch_MinExlMaxExlMismatch = 356,
            Sch_MinIncMaxExlMismatch = 357,
            Sch_MinIncExlMismatch = 358,
            Sch_MaxIncExlMismatch = 359,
            Sch_MaxExlIncMismatch = 360,
            Sch_TotalDigitsMismatch = 361,
            Sch_FacetBaseFixed = 362,
            Sch_WhiteSpaceRestriction1 = 363,
            Sch_WhiteSpaceRestriction2 = 364,
            Sch_XsiNilAndFixed = 365,
            Sch_MixSchemaTypes = 366,
            Sch_XSDSchemaOnly = 367,
            Sch_InvalidPublicAttribute = 368,
            Sch_InvalidSystemAttribute = 369,
            Sch_TypeAfterConstraints = 370,
            Sch_XsiNilAndType = 371,
            Sch_DupSimpleTypeChild = 372,
            Sch_InvalidIdAttribute = 373,
            Sch_InvalidNameAttributeEx = 374,
            Sch_InvalidAttribute = 375,
            Sch_EmptyChoice = 376,
            Sch_DerivedNotFromBase = 377,
            Sch_NeedSimpleTypeChild = 378,
            Sch_InvalidCollection = 379,
            Sch_UnrefNS = 380,
            Sch_InvalidSimpleTypeRestriction = 381,
            Sch_MultipleRedefine = 382,
            Sch_NullValue = 383,
            Sch_ComplexContentModel = 384,
            Sch_SchemaNotPreprocessed = 385,
            Sch_SchemaNotRemoved = 386,
            Sch_ComponentAlreadySeenForNS = 387,
            Sch_DefaultAttributeNotApplied = 388,
            Sch_NotXsiAttribute = 389,
            Sch_SchemaDoesNotExist = 390,
            Sch_InvalidStartTransition = 391,
            Sch_InvalidStateTransition = 392,
            Sch_InvalidEndValidation = 393,
            Sch_InvalidEndElementCall = 394,
            Sch_InvalidEndElementCallTyped = 395,
            Sch_InvalidEndElementMultiple = 396,
            Sch_DuplicateAttribute = 397,
            Sch_InvalidPartialValidationType = 398,
            Sch_SchemaElementNameMismatch = 399,
            Sch_SchemaAttributeNameMismatch = 400,
            Sch_ValidateAttributeInvalidCall = 401,
            Sch_ValidateElementInvalidCall = 402,
            Sch_EnumNotStarted = 403,
            Sch_EnumFinished = 404,
            Sch_ErrorPosition = 405,
            Sch_ReservedNsDecl = 406,
            Sch_NotInSchemaCollection = 407,
            Sch_NotationNotAttr = 408,
            Sch_InvalidContent = 409,
            Sch_InvalidContentExpecting = 410,
            Sch_InvalidTextWhiteSpace = 411,
            Sch_XSCHEMA = 412,
            Sch_DubSchema = 413,
            Sch_AttributeValueDataType = 414,
            Sch_ElementValueDataType = 415,
            Sch_NonDeterministicAny = 416,
            Sch_MismatchTargetNamespace = 417,
            Sch_UnionFailed = 418,
            Sch_XsiTypeBlocked = 419,
            Sch_InvalidElementInEmpty = 420,
            Sch_InvalidElementInTextOnly = 421,
            Sch_InvalidNameAttribute = 422
            #endregion
        }


    }
}
于 2020-09-09T06:18:01.713 に答える