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

◆ CompileSimpleType()

void System.Xml.Schema.Compiler.CompileSimpleType ( XmlSchemaSimpleType simpleType)
inlineprivate

Definition at line 558 of file Compiler.cs.

559 {
560 if (simpleType.IsProcessing)
561 {
562 throw new XmlSchemaException(System.SR.Sch_TypeCircularRef, simpleType);
563 }
564 if (simpleType.ElementDecl != null)
565 {
566 return;
567 }
569 try
570 {
571 if (simpleType.Content is XmlSchemaSimpleTypeList)
572 {
573 XmlSchemaSimpleTypeList xmlSchemaSimpleTypeList = (XmlSchemaSimpleTypeList)simpleType.Content;
574 simpleType.SetBaseSchemaType(DatatypeImplementation.AnySimpleType);
575 XmlSchemaDatatype datatype;
576 if (xmlSchemaSimpleTypeList.ItemTypeName.IsEmpty)
577 {
580 datatype = xmlSchemaSimpleTypeList.ItemType.Datatype;
581 }
582 else
583 {
584 XmlSchemaSimpleType simpleType2 = GetSimpleType(xmlSchemaSimpleTypeList.ItemTypeName);
585 if (simpleType2 == null)
586 {
587 throw new XmlSchemaException(System.SR.Sch_UndeclaredSimpleType, xmlSchemaSimpleTypeList.ItemTypeName.ToString(), xmlSchemaSimpleTypeList);
588 }
589 if ((simpleType2.FinalResolved & XmlSchemaDerivationMethod.List) != 0)
590 {
592 }
594 datatype = simpleType2.Datatype;
595 }
596 simpleType.SetDatatype(datatype.DeriveByList(simpleType));
597 simpleType.SetDerivedBy(XmlSchemaDerivationMethod.List);
598 }
599 else if (simpleType.Content is XmlSchemaSimpleTypeRestriction)
600 {
601 XmlSchemaSimpleTypeRestriction xmlSchemaSimpleTypeRestriction = (XmlSchemaSimpleTypeRestriction)simpleType.Content;
602 XmlSchemaDatatype datatype2;
603 if (xmlSchemaSimpleTypeRestriction.BaseTypeName.IsEmpty)
604 {
606 simpleType.SetBaseSchemaType(xmlSchemaSimpleTypeRestriction.BaseType);
607 datatype2 = xmlSchemaSimpleTypeRestriction.BaseType.Datatype;
608 }
609 else if (simpleType.Redefined != null && xmlSchemaSimpleTypeRestriction.BaseTypeName == simpleType.Redefined.QualifiedName)
610 {
611 CompileSimpleType((XmlSchemaSimpleType)simpleType.Redefined);
612 simpleType.SetBaseSchemaType(simpleType.Redefined.BaseXmlSchemaType);
613 datatype2 = simpleType.Redefined.Datatype;
614 }
615 else
616 {
617 if (xmlSchemaSimpleTypeRestriction.BaseTypeName.Equals(DatatypeImplementation.QnAnySimpleType))
618 {
619 XmlSchema parentSchema = Preprocessor.GetParentSchema(simpleType);
620 if (parentSchema.TargetNamespace != "http://www.w3.org/2001/XMLSchema")
621 {
622 throw new XmlSchemaException(System.SR.Sch_InvalidSimpleTypeRestriction, xmlSchemaSimpleTypeRestriction.BaseTypeName.ToString(), simpleType);
623 }
624 }
625 XmlSchemaSimpleType simpleType3 = GetSimpleType(xmlSchemaSimpleTypeRestriction.BaseTypeName);
626 if (simpleType3 == null)
627 {
628 throw new XmlSchemaException(System.SR.Sch_UndeclaredSimpleType, xmlSchemaSimpleTypeRestriction.BaseTypeName.ToString(), xmlSchemaSimpleTypeRestriction);
629 }
630 if ((simpleType3.FinalResolved & XmlSchemaDerivationMethod.Restriction) != 0)
631 {
633 }
634 simpleType.SetBaseSchemaType(simpleType3);
635 datatype2 = simpleType3.Datatype;
636 }
637 simpleType.SetDatatype(datatype2.DeriveByRestriction(xmlSchemaSimpleTypeRestriction.Facets, base.NameTable, simpleType));
638 simpleType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
639 }
640 else
641 {
642 XmlSchemaSimpleType[] types = CompileBaseMemberTypes(simpleType);
643 simpleType.SetBaseSchemaType(DatatypeImplementation.AnySimpleType);
644 simpleType.SetDatatype(XmlSchemaDatatype.DeriveByUnion(types, simpleType));
645 simpleType.SetDerivedBy(XmlSchemaDerivationMethod.Union);
646 }
647 }
648 catch (XmlSchemaException ex)
649 {
650 if (ex.SourceSchemaObject == null)
651 {
652 ex.SetSource(simpleType);
653 }
655 simpleType.SetDatatype(DatatypeImplementation.AnySimpleType.Datatype);
656 }
657 finally
658 {
659 SchemaElementDecl schemaElementDecl = new SchemaElementDecl();
660 schemaElementDecl.ContentValidator = ContentValidator.TextOnly;
665 }
666 }
static string Sch_TypeCircularRef
Definition SR.cs:952
static string Sch_InvalidSimpleTypeRestriction
Definition SR.cs:1152
static string Sch_UndeclaredSimpleType
Definition SR.cs:560
static string Sch_BaseFinalList
Definition SR.cs:968
static string Sch_BaseFinalRestriction
Definition SR.cs:966
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
XmlSchemaSimpleType[] CompileBaseMemberTypes(XmlSchemaSimpleType simpleType)
Definition Compiler.cs:668
void CompileSimpleType(XmlSchemaSimpleType simpleType)
Definition Compiler.cs:558
XmlSchemaSimpleType GetSimpleType(XmlQualifiedName name)
Definition Compiler.cs:2716

References System.Xml.Schema.DatatypeImplementation.AnySimpleType, System.Xml.Schema.Compiler.CompileBaseMemberTypes(), System.Xml.Schema.Compiler.CompileSimpleType(), System.Xml.Schema.XmlSchemaDatatype.DeriveByList(), System.Xml.Schema.XmlSchemaDatatype.DeriveByUnion(), System.Xml.Dictionary, System.Xml.Schema.Preprocessor.GetParentSchema(), System.Xml.Schema.Compiler.GetSimpleType(), System.Xml.Schema.DatatypeImplementation.QnAnySimpleType, System.SR.Sch_BaseFinalList, System.SR.Sch_BaseFinalRestriction, System.SR.Sch_InvalidSimpleTypeRestriction, System.SR.Sch_TypeCircularRef, System.SR.Sch_UndeclaredSimpleType, System.Xml.Schema.BaseProcessor.SendValidationEvent(), and System.Xml.Schema.ContentValidator.TextOnly.

Referenced by System.Xml.Schema.Compiler.Compile(), System.Xml.Schema.Compiler.CompileAttribute(), System.Xml.Schema.Compiler.CompileBaseMemberTypes(), System.Xml.Schema.Compiler.CompileElement(), System.Xml.Schema.Compiler.CompileSimpleContentRestriction(), System.Xml.Schema.Compiler.CompileSimpleType(), System.Xml.Schema.Compiler.GetAnySchemaType(), and System.Xml.Schema.Compiler.GetSimpleType().