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

◆ ElementValidationError()

static void System.Xml.Schema.XmlSchemaValidator.ElementValidationError ( XmlQualifiedName name,
ValidationState context,
ValidationEventHandler eventHandler,
object sender,
string sourceUri,
int lineNo,
int linePos,
XmlSchemaSet schemaSet )
inlinestaticpackage

Definition at line 2303 of file XmlSchemaValidator.cs.

2304 {
2305 ArrayList arrayList = null;
2306 if (context.ElementDecl == null)
2307 {
2308 return;
2309 }
2310 ContentValidator contentValidator = context.ElementDecl.ContentValidator;
2311 XmlSchemaContentType contentType = contentValidator.ContentType;
2312 if (contentType == XmlSchemaContentType.ElementOnly || (contentType == XmlSchemaContentType.Mixed && contentValidator != ContentValidator.Mixed && contentValidator != ContentValidator.Any))
2313 {
2314 bool flag = schemaSet != null;
2315 arrayList = ((!flag) ? contentValidator.ExpectedElements(context, isRequiredOnly: false) : contentValidator.ExpectedParticles(context, isRequiredOnly: false, schemaSet));
2316 if (arrayList == null || arrayList.Count == 0)
2317 {
2318 if (context.TooComplex)
2319 {
2320 SendValidationEvent(eventHandler, sender, new XmlSchemaValidationException(System.SR.Sch_InvalidElementContentComplex, new string[3]
2321 {
2322 BuildElementName(context.LocalName, context.Namespace),
2323 BuildElementName(name),
2324 System.SR.Sch_ComplexContentModel
2325 }, sourceUri, lineNo, linePos), XmlSeverityType.Error);
2326 }
2327 else
2328 {
2329 SendValidationEvent(eventHandler, sender, new XmlSchemaValidationException(System.SR.Sch_InvalidElementContent, new string[2]
2330 {
2331 BuildElementName(context.LocalName, context.Namespace),
2332 BuildElementName(name)
2333 }, sourceUri, lineNo, linePos), XmlSeverityType.Error);
2334 }
2335 }
2336 else if (context.TooComplex)
2337 {
2338 SendValidationEvent(eventHandler, sender, new XmlSchemaValidationException(System.SR.Sch_InvalidElementContentExpectingComplex, new string[4]
2339 {
2340 BuildElementName(context.LocalName, context.Namespace),
2341 BuildElementName(name),
2342 PrintExpectedElements(arrayList, flag),
2343 System.SR.Sch_ComplexContentModel
2344 }, sourceUri, lineNo, linePos), XmlSeverityType.Error);
2345 }
2346 else
2347 {
2348 SendValidationEvent(eventHandler, sender, new XmlSchemaValidationException(System.SR.Sch_InvalidElementContentExpecting, new string[3]
2349 {
2350 BuildElementName(context.LocalName, context.Namespace),
2351 BuildElementName(name),
2352 PrintExpectedElements(arrayList, flag)
2353 }, sourceUri, lineNo, linePos), XmlSeverityType.Error);
2354 }
2355 }
2356 else if (contentType == XmlSchemaContentType.Empty)
2357 {
2358 SendValidationEvent(eventHandler, sender, new XmlSchemaValidationException(System.SR.Sch_InvalidElementInEmptyEx, new string[2]
2359 {
2360 QNameString(context.LocalName, context.Namespace),
2361 name.ToString()
2362 }, sourceUri, lineNo, linePos), XmlSeverityType.Error);
2363 }
2364 else if (!contentValidator.IsOpen)
2365 {
2366 SendValidationEvent(eventHandler, sender, new XmlSchemaValidationException(System.SR.Sch_InvalidElementInTextOnlyEx, new string[2]
2367 {
2368 QNameString(context.LocalName, context.Namespace),
2369 name.ToString()
2370 }, sourceUri, lineNo, linePos), XmlSeverityType.Error);
2371 }
2372 }
static string Sch_InvalidElementContentExpecting
Definition SR.cs:896
static string Sch_InvalidElementContentExpectingComplex
Definition SR.cs:898
static string Sch_InvalidElementInEmptyEx
Definition SR.cs:880
static string Sch_InvalidElementContentComplex
Definition SR.cs:888
static string Sch_InvalidElementContent
Definition SR.cs:886
static string Sch_InvalidElementInTextOnlyEx
Definition SR.cs:882
Definition SR.cs:7

References System.Xml.Schema.ContentValidator.Any, System.Xml.Schema.SchemaElementDecl.ContentValidator, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Schema.ValidationState.ElementDecl, System.Xml.Schema.ContentValidator.Mixed, System.SR.Sch_InvalidElementContent, System.SR.Sch_InvalidElementContentComplex, System.SR.Sch_InvalidElementContentExpecting, System.SR.Sch_InvalidElementContentExpectingComplex, System.SR.Sch_InvalidElementInEmptyEx, System.SR.Sch_InvalidElementInTextOnlyEx, System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(), and System.Xml.Schema.ValidationState.TooComplex.

Referenced by System.Xml.Schema.DtdValidator.ValidateChildElement(), System.Xml.Schema.XdrValidator.ValidateChildElement(), System.Xml.Schema.XsdValidator.ValidateChildElement(), and System.Xml.Schema.XmlSchemaValidator.ValidateElementContext().