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

◆ CompileIdentityConstraint()

void System.Xml.Schema.Compiler.CompileIdentityConstraint ( XmlSchemaIdentityConstraint xi)
inlineprivate

Definition at line 2291 of file Compiler.cs.

2292 {
2293 if (xi.IsProcessing)
2294 {
2295 xi.CompiledConstraint = CompiledIdentityConstraint.Empty;
2297 }
2298 else
2299 {
2300 if (xi.CompiledConstraint != null)
2301 {
2302 return;
2303 }
2304 xi.IsProcessing = true;
2305 CompiledIdentityConstraint compiledIdentityConstraint = null;
2306 try
2307 {
2308 SchemaNamespaceManager nsmgr = new SchemaNamespaceManager(xi);
2309 compiledIdentityConstraint = new CompiledIdentityConstraint(xi, nsmgr);
2310 if (xi is XmlSchemaKeyref)
2311 {
2312 XmlSchemaIdentityConstraint xmlSchemaIdentityConstraint = (XmlSchemaIdentityConstraint)_identityConstraints[((XmlSchemaKeyref)xi).Refer];
2313 if (xmlSchemaIdentityConstraint == null)
2314 {
2315 throw new XmlSchemaException(System.SR.Sch_UndeclaredIdentityConstraint, ((XmlSchemaKeyref)xi).Refer.ToString(), xi);
2316 }
2318 if (xmlSchemaIdentityConstraint.CompiledConstraint == null)
2319 {
2320 throw new XmlSchemaException(System.SR.Sch_RefInvalidIdentityConstraint, ((XmlSchemaKeyref)xi).Refer.ToString(), xi);
2321 }
2322 if (xmlSchemaIdentityConstraint.Fields.Count != xi.Fields.Count)
2323 {
2324 throw new XmlSchemaException(System.SR.Sch_RefInvalidCardin, xi.QualifiedName.ToString(), xi);
2325 }
2326 if (xmlSchemaIdentityConstraint.CompiledConstraint.Role == CompiledIdentityConstraint.ConstraintRole.Keyref)
2327 {
2328 throw new XmlSchemaException(System.SR.Sch_ReftoKeyref, xi.QualifiedName.ToString(), xi);
2329 }
2330 }
2332 }
2333 catch (XmlSchemaException ex)
2334 {
2335 if (ex.SourceSchemaObject == null)
2336 {
2337 ex.SetSource(xi);
2338 }
2340 xi.CompiledConstraint = CompiledIdentityConstraint.Empty;
2341 }
2342 finally
2343 {
2344 xi.IsProcessing = false;
2345 }
2346 }
2347 }
static string Sch_IdentityConstraintCircularRef
Definition SR.cs:928
static string Sch_RefInvalidCardin
Definition SR.cs:724
static string Sch_RefInvalidIdentityConstraint
Definition SR.cs:722
static string Sch_UndeclaredIdentityConstraint
Definition SR.cs:720
static string Sch_ReftoKeyref
Definition SR.cs:726
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void CompileIdentityConstraint(XmlSchemaIdentityConstraint xi)
Definition Compiler.cs:2291
readonly XmlSchemaObjectTable _identityConstraints
Definition Compiler.cs:26

References System.Xml.Schema.Compiler._identityConstraints, System.Xml.Schema.Compiler.CompileIdentityConstraint(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Schema.CompiledIdentityConstraint.Empty, System.SR.Sch_IdentityConstraintCircularRef, System.SR.Sch_RefInvalidCardin, System.SR.Sch_RefInvalidIdentityConstraint, System.SR.Sch_ReftoKeyref, System.SR.Sch_UndeclaredIdentityConstraint, and System.Xml.Schema.BaseProcessor.SendValidationEvent().

Referenced by System.Xml.Schema.Compiler.Compile(), System.Xml.Schema.Compiler.CompileElement(), and System.Xml.Schema.Compiler.CompileIdentityConstraint().