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

◆ CompileAttribute()

void System.Xml.Schema.Compiler.CompileAttribute ( XmlSchemaAttribute xa)
inlineprivate

Definition at line 2133 of file Compiler.cs.

2134 {
2135 if (xa.IsProcessing)
2136 {
2138 }
2139 else
2140 {
2141 if (xa.AttDef != null)
2142 {
2143 return;
2144 }
2145 xa.IsProcessing = true;
2146 SchemaAttDef schemaAttDef = null;
2147 try
2148 {
2149 if (!xa.RefName.IsEmpty)
2150 {
2151 XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute)_attributes[xa.RefName];
2152 if (xmlSchemaAttribute == null)
2153 {
2154 throw new XmlSchemaException(System.SR.Sch_UndeclaredAttribute, xa.RefName.ToString(), xa);
2155 }
2157 if (xmlSchemaAttribute.AttDef == null)
2158 {
2159 throw new XmlSchemaException(System.SR.Sch_RefInvalidAttribute, xa.RefName.ToString(), xa);
2160 }
2161 schemaAttDef = xmlSchemaAttribute.AttDef.Clone();
2162 XmlSchemaDatatype datatype = schemaAttDef.Datatype;
2163 if (datatype != null)
2164 {
2165 if (xmlSchemaAttribute.FixedValue == null && xmlSchemaAttribute.DefaultValue == null)
2166 {
2168 }
2169 else if (xmlSchemaAttribute.FixedValue != null)
2170 {
2171 if (xa.DefaultValue != null)
2172 {
2173 throw new XmlSchemaException(System.SR.Sch_FixedDefaultInRef, xa.RefName.ToString(), xa);
2174 }
2175 if (xa.FixedValue != null)
2176 {
2177 object o = datatype.ParseValue(xa.FixedValue, base.NameTable, new SchemaNamespaceManager(xa), createAtomicValue: true);
2178 if (!datatype.IsEqual(schemaAttDef.DefaultValueTyped, o))
2179 {
2180 throw new XmlSchemaException(System.SR.Sch_FixedInRef, xa.RefName.ToString(), xa);
2181 }
2182 }
2183 }
2184 }
2185 xa.SetAttributeType(xmlSchemaAttribute.AttributeSchemaType);
2186 }
2187 else
2188 {
2189 schemaAttDef = new SchemaAttDef(xa.QualifiedName);
2190 if (xa.SchemaType != null)
2191 {
2192 CompileSimpleType(xa.SchemaType);
2193 xa.SetAttributeType(xa.SchemaType);
2194 schemaAttDef.SchemaType = xa.SchemaType;
2195 schemaAttDef.Datatype = xa.SchemaType.Datatype;
2196 }
2197 else if (!xa.SchemaTypeName.IsEmpty)
2198 {
2199 XmlSchemaSimpleType simpleType = GetSimpleType(xa.SchemaTypeName);
2200 if (simpleType == null)
2201 {
2202 throw new XmlSchemaException(System.SR.Sch_UndeclaredSimpleType, xa.SchemaTypeName.ToString(), xa);
2203 }
2204 xa.SetAttributeType(simpleType);
2207 }
2208 else
2209 {
2210 schemaAttDef.SchemaType = DatatypeImplementation.AnySimpleType;
2211 schemaAttDef.Datatype = DatatypeImplementation.AnySimpleType.Datatype;
2212 xa.SetAttributeType(DatatypeImplementation.AnySimpleType);
2213 }
2214 if (schemaAttDef.Datatype != null)
2215 {
2216 schemaAttDef.Datatype.VerifySchemaValid(_notations, xa);
2217 }
2219 }
2222 }
2223 catch (XmlSchemaException ex)
2224 {
2225 if (ex.SourceSchemaObject == null)
2226 {
2227 ex.SetSource(xa);
2228 }
2230 xa.AttDef = SchemaAttDef.Empty;
2231 }
2232 finally
2233 {
2234 xa.IsProcessing = false;
2235 }
2236 }
2237 }
static string Sch_UndeclaredSimpleType
Definition SR.cs:560
static string Sch_FixedInRef
Definition SR.cs:538
static string Sch_FixedDefaultInRef
Definition SR.cs:540
static string Sch_RefInvalidAttribute
Definition SR.cs:1064
static string Sch_AttributeCircularRef
Definition SR.cs:926
static string Sch_UndeclaredAttribute
Definition SR.cs:414
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
readonly XmlSchemaObjectTable _attributes
Definition Compiler.cs:12
void CompileAttribute(XmlSchemaAttribute xa)
Definition Compiler.cs:2133
void CompileSimpleType(XmlSchemaSimpleType simpleType)
Definition Compiler.cs:558
void SetDefaultFixed(XmlSchemaAttribute xa, SchemaAttDef decl)
Definition Compiler.cs:2239
readonly XmlSchemaObjectTable _notations
Definition Compiler.cs:22
XmlSchemaSimpleType GetSimpleType(XmlQualifiedName name)
Definition Compiler.cs:2716

References System.Xml.Schema.Compiler._attributes, System.Xml.Schema.Compiler._notations, System.Xml.Schema.DatatypeImplementation.AnySimpleType, System.Xml.Schema.Compiler.CompileAttribute(), System.Xml.Schema.Compiler.CompileSimpleType(), System.Xml.Dictionary, System.Xml.Schema.SchemaAttDef.Empty, System.Xml.Schema.Compiler.GetSimpleType(), System.Xml.Schema.XmlSchemaDatatype.IsEqual(), System.Xml.Schema.XmlSchemaDatatype.ParseValue(), System.SR.Sch_AttributeCircularRef, System.SR.Sch_FixedDefaultInRef, System.SR.Sch_FixedInRef, System.SR.Sch_RefInvalidAttribute, System.SR.Sch_UndeclaredAttribute, System.SR.Sch_UndeclaredSimpleType, System.Xml.Schema.BaseProcessor.SendValidationEvent(), and System.Xml.Schema.Compiler.SetDefaultFixed().

Referenced by System.Xml.Schema.Compiler.Compile(), System.Xml.Schema.Compiler.CompileAttribute(), System.Xml.Schema.Compiler.CompileAttributeGroup(), and System.Xml.Schema.Compiler.CompileLocalAttributes().