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

◆ CompileSimpleContentRestriction()

void System.Xml.Schema.Compiler.CompileSimpleContentRestriction ( XmlSchemaComplexType complexType,
XmlSchemaSimpleContentRestriction simpleRestriction )
inlineprivate

Definition at line 852 of file Compiler.cs.

853 {
854 XmlSchemaComplexType xmlSchemaComplexType = null;
855 XmlSchemaDatatype xmlSchemaDatatype = null;
856 if (complexType.Redefined != null && simpleRestriction.BaseTypeName == complexType.Redefined.QualifiedName)
857 {
858 xmlSchemaComplexType = (XmlSchemaComplexType)complexType.Redefined;
861 }
862 else
863 {
865 if (xmlSchemaComplexType == null)
866 {
868 return;
869 }
870 if (xmlSchemaComplexType.ContentType == XmlSchemaContentType.TextOnly)
871 {
872 if (simpleRestriction.BaseType == null)
873 {
875 }
876 else
877 {
879 if (!XmlSchemaType.IsDerivedFromDatatype(simpleRestriction.BaseType.Datatype, xmlSchemaComplexType.Datatype, XmlSchemaDerivationMethod.None))
880 {
882 }
883 xmlSchemaDatatype = simpleRestriction.BaseType.Datatype;
884 }
885 }
886 else if (xmlSchemaComplexType.ContentType == XmlSchemaContentType.Mixed && xmlSchemaComplexType.ElementDecl.ContentValidator.IsEmptiable)
887 {
888 if (simpleRestriction.BaseType != null)
889 {
891 complexType.SetBaseSchemaType(simpleRestriction.BaseType);
892 xmlSchemaDatatype = simpleRestriction.BaseType.Datatype;
893 }
894 else
895 {
897 }
898 }
899 else
900 {
902 }
903 }
904 if (xmlSchemaComplexType != null && xmlSchemaComplexType.ElementDecl != null && (xmlSchemaComplexType.FinalResolved & XmlSchemaDerivationMethod.Restriction) != 0)
905 {
907 }
908 if (xmlSchemaComplexType != null)
909 {
910 complexType.SetBaseSchemaType(xmlSchemaComplexType);
911 }
912 if (xmlSchemaDatatype != null)
913 {
914 try
915 {
916 complexType.SetDatatype(xmlSchemaDatatype.DeriveByRestriction(simpleRestriction.Facets, base.NameTable, complexType));
917 }
918 catch (XmlSchemaException ex)
919 {
920 if (ex.SourceSchemaObject == null)
921 {
922 ex.SetSource(complexType);
923 }
925 complexType.SetDatatype(DatatypeImplementation.AnySimpleType.Datatype);
926 }
927 }
928 complexType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
929 CompileLocalAttributes(xmlSchemaComplexType, complexType, simpleRestriction.Attributes, simpleRestriction.AnyAttribute, XmlSchemaDerivationMethod.Restriction);
930 }
static string Sch_NotSimpleContent
Definition SR.cs:962
static string Sch_NeedSimpleTypeChild
Definition SR.cs:1146
static string Sch_DerivedNotFromBase
Definition SR.cs:1144
static string Sch_UndefBaseRestriction
Definition SR.cs:972
static string Sch_BaseFinalRestriction
Definition SR.cs:966
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void CompileLocalAttributes(XmlSchemaComplexType baseType, XmlSchemaComplexType derivedType, XmlSchemaObjectCollection attributes, XmlSchemaAnyAttribute anyAttribute, XmlSchemaDerivationMethod derivedBy)
Definition Compiler.cs:1907
void CompileComplexType(XmlSchemaComplexType complexType)
Definition Compiler.cs:730
void CompileSimpleType(XmlSchemaSimpleType simpleType)
Definition Compiler.cs:558
XmlSchemaComplexType GetComplexType(XmlQualifiedName name)
Definition Compiler.cs:2730

References System.Xml.Schema.DatatypeImplementation.AnySimpleType, System.Xml.Schema.Compiler.CompileComplexType(), System.Xml.Schema.Compiler.CompileLocalAttributes(), System.Xml.Schema.Compiler.CompileSimpleType(), System.Xml.Schema.Compiler.GetComplexType(), System.Xml.Schema.XmlSchemaType.IsDerivedFromDatatype(), System.SR.Sch_BaseFinalRestriction, System.SR.Sch_DerivedNotFromBase, System.SR.Sch_NeedSimpleTypeChild, System.SR.Sch_NotSimpleContent, System.SR.Sch_UndefBaseRestriction, and System.Xml.Schema.BaseProcessor.SendValidationEvent().

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