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

◆ CheckDefaultValue()

static void System.Xml.Schema.DtdValidator.CheckDefaultValue ( SchemaAttDef attdef,
SchemaInfo sinfo,
IValidationEventHandling eventHandling,
string baseUriStr )
inlinestatic

Definition at line 523 of file DtdValidator.cs.

524 {
525 try
526 {
527 if (baseUriStr == null)
528 {
529 baseUriStr = string.Empty;
530 }
531 XmlSchemaDatatype datatype = attdef.Datatype;
532 if (datatype == null)
533 {
534 return;
535 }
536 object defaultValueTyped = attdef.DefaultValueTyped;
537 switch (datatype.TokenizedType)
538 {
539 case XmlTokenizedType.ENTITY:
540 if (datatype.Variety == XmlSchemaDatatypeVariety.List)
541 {
542 string[] array = (string[])defaultValueTyped;
543 for (int i = 0; i < array.Length; i++)
544 {
545 BaseValidator.ProcessEntity(sinfo, array[i], eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
546 }
547 }
548 else
549 {
550 BaseValidator.ProcessEntity(sinfo, (string)defaultValueTyped, eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
551 }
552 break;
553 case XmlTokenizedType.ENUMERATION:
554 if (!attdef.CheckEnumeration(defaultValueTyped) && eventHandling != null)
555 {
556 XmlSchemaException exception = new XmlSchemaException(System.SR.Sch_EnumerationValue, defaultValueTyped.ToString(), baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
557 eventHandling.SendEvent(exception, XmlSeverityType.Error);
558 }
559 break;
560 }
561 }
562 catch (Exception)
563 {
564 if (eventHandling != null)
565 {
566 XmlSchemaException exception2 = new XmlSchemaException(System.SR.Sch_AttributeDefaultDataType, attdef.Name.ToString());
567 eventHandling.SendEvent(exception2, XmlSeverityType.Error);
568 }
569 }
570 }
static string Sch_AttributeDefaultDataType
Definition SR.cs:498
static string Sch_EnumerationValue
Definition SR.cs:568
Definition SR.cs:7
BaseValidator(BaseValidator other)

References System.array, System.Xml.Dictionary, System.exception, System.Xml.Schema.BaseValidator.ProcessEntity(), System.SR.Sch_AttributeDefaultDataType, System.SR.Sch_EnumerationValue, System.Xml.Schema.XmlSchemaDatatype.TokenizedType, and System.Xml.Schema.XmlSchemaDatatype.Variety.

Referenced by System.Xml.XmlValidatingReaderImpl.ValidateDefaultAttributeOnUse().