Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CompileComplexContent()

ContentValidator System.Xml.Schema.Compiler.CompileComplexContent ( XmlSchemaComplexType complexType)
inlineprivate

Definition at line 2520 of file Compiler.cs.

2521 {
2522 if (complexType.ContentType == XmlSchemaContentType.Empty)
2523 {
2524 return ContentValidator.Empty;
2525 }
2526 if (complexType.ContentType == XmlSchemaContentType.TextOnly)
2527 {
2528 return ContentValidator.TextOnly;
2529 }
2530 XmlSchemaParticle contentTypeParticle = complexType.ContentTypeParticle;
2531 if (contentTypeParticle == null || contentTypeParticle == XmlSchemaParticle.Empty)
2532 {
2533 if (complexType.ContentType == XmlSchemaContentType.ElementOnly)
2534 {
2535 return ContentValidator.Empty;
2536 }
2537 return ContentValidator.Mixed;
2538 }
2540 if (contentTypeParticle is XmlSchemaAll)
2541 {
2542 XmlSchemaAll xmlSchemaAll = (XmlSchemaAll)contentTypeParticle;
2543 AllElementsContentValidator allElementsContentValidator = new AllElementsContentValidator(complexType.ContentType, xmlSchemaAll.Items.Count, xmlSchemaAll.MinOccurs == 0m);
2544 for (int i = 0; i < xmlSchemaAll.Items.Count; i++)
2545 {
2546 XmlSchemaElement xmlSchemaElement = (XmlSchemaElement)xmlSchemaAll.Items[i];
2547 if (!allElementsContentValidator.AddElement(xmlSchemaElement.QualifiedName, xmlSchemaElement, xmlSchemaElement.MinOccurs == 0m))
2548 {
2550 }
2551 }
2553 }
2554 ParticleContentValidator particleContentValidator = new ParticleContentValidator(complexType.ContentType, base.CompilationSettings.EnableUpaCheck);
2555 try
2556 {
2559 return particleContentValidator.Finish(useDFA: true);
2560 }
2561 catch (UpaException ex)
2562 {
2563 if (ex.Particle1 is XmlSchemaElement)
2564 {
2565 if (ex.Particle2 is XmlSchemaElement)
2566 {
2567 SendValidationEvent(System.SR.Sch_NonDeterministic, ((XmlSchemaElement)ex.Particle1).QualifiedName.ToString(), (XmlSchemaElement)ex.Particle2);
2568 }
2569 else
2570 {
2571 SendValidationEvent(System.SR.Sch_NonDeterministicAnyEx, ((XmlSchemaAny)ex.Particle2).ResolvedNamespace, ((XmlSchemaElement)ex.Particle1).QualifiedName.ToString(), (XmlSchemaAny)ex.Particle2);
2572 }
2573 }
2574 else if (ex.Particle2 is XmlSchemaElement)
2575 {
2576 SendValidationEvent(System.SR.Sch_NonDeterministicAnyEx, ((XmlSchemaAny)ex.Particle1).ResolvedNamespace, ((XmlSchemaElement)ex.Particle2).QualifiedName.ToString(), (XmlSchemaElement)ex.Particle2);
2577 }
2578 else
2579 {
2580 SendValidationEvent(System.SR.Sch_NonDeterministicAnyAny, ((XmlSchemaAny)ex.Particle1).ResolvedNamespace, ((XmlSchemaAny)ex.Particle2).ResolvedNamespace, (XmlSchemaAny)ex.Particle2);
2581 }
2582 return XmlSchemaComplexType.AnyTypeContentValidator;
2583 }
2584 catch (NotSupportedException)
2585 {
2587 return XmlSchemaComplexType.AnyTypeContentValidator;
2588 }
2589 }
static string Sch_NonDeterministic
Definition SR.cs:584
static string Sch_DupElement
Definition SR.cs:480
static string Sch_ComplexContentModel
Definition SR.cs:1158
static string Sch_NonDeterministicAnyEx
Definition SR.cs:586
static string Sch_NonDeterministicAnyAny
Definition SR.cs:588
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void PushComplexType(XmlSchemaComplexType complexType)
Definition Compiler.cs:1823
bool BuildParticleContentModel(ParticleContentValidator contentValidator, XmlSchemaParticle particle)
Definition Compiler.cs:2591

References System.Xml.Schema.XmlSchemaComplexType.AnyTypeContentValidator, System.Xml.Schema.Compiler.BuildParticleContentModel(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Schema.ContentValidator.Empty, System.Xml.Schema.XmlSchemaParticle.Empty, System.Xml.Schema.ContentValidator.Mixed, System.Xml.Schema.Compiler.PushComplexType(), System.SR.Sch_ComplexContentModel, System.SR.Sch_DupElement, System.SR.Sch_NonDeterministic, System.SR.Sch_NonDeterministicAnyAny, System.SR.Sch_NonDeterministicAnyEx, System.Xml.Schema.BaseProcessor.SendValidationEvent(), and System.Xml.Schema.ContentValidator.TextOnly.

Referenced by System.Xml.Schema.Compiler.CompileComplexType().