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

◆ CheckDefaultValue()

static void System.Xml.Schema.XdrValidator.CheckDefaultValue ( string value,
SchemaAttDef attdef,
SchemaInfo sinfo,
XmlNamespaceManager nsManager,
XmlNameTable NameTable,
object sender,
ValidationEventHandler eventhandler,
string baseUri,
int lineNo,
int linePos )
inlinestatic

Definition at line 516 of file XdrValidator.cs.

517 {
518 try
519 {
520 XmlSchemaDatatype datatype = attdef.Datatype;
521 if (datatype == null)
522 {
523 return;
524 }
525 if (datatype.TokenizedType != 0)
526 {
527 value = value.Trim();
528 }
529 if (value.Length == 0)
530 {
531 return;
532 }
533 object obj = datatype.ParseValue(value, NameTable, nsManager);
534 switch (datatype.TokenizedType)
535 {
536 case XmlTokenizedType.ENTITY:
537 if (datatype.Variety == XmlSchemaDatatypeVariety.List)
538 {
539 string[] array = (string[])obj;
540 for (int i = 0; i < array.Length; i++)
541 {
542 BaseValidator.ProcessEntity(sinfo, array[i], sender, eventhandler, baseUri, lineNo, linePos);
543 }
544 }
545 else
546 {
547 BaseValidator.ProcessEntity(sinfo, (string)obj, sender, eventhandler, baseUri, lineNo, linePos);
548 }
549 break;
550 case XmlTokenizedType.ENUMERATION:
551 if (!attdef.CheckEnumeration(obj))
552 {
553 XmlSchemaException ex = new XmlSchemaException(System.SR.Sch_EnumerationValue, obj.ToString(), baseUri, lineNo, linePos);
554 if (eventhandler == null)
555 {
556 throw ex;
557 }
558 eventhandler(sender, new ValidationEventArgs(ex));
559 }
560 break;
561 }
563 }
564 catch
565 {
566 XmlSchemaException ex2 = new XmlSchemaException(System.SR.Sch_AttributeDefaultDataType, attdef.Name.ToString(), baseUri, lineNo, linePos);
567 if (eventhandler != null)
568 {
569 eventhandler(sender, new ValidationEventArgs(ex2));
570 return;
571 }
572 throw ex2;
573 }
574 }
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.obj, System.Xml.Schema.XmlSchemaDatatype.ParseValue(), System.Xml.Schema.BaseValidator.ProcessEntity(), System.SR.Sch_AttributeDefaultDataType, System.SR.Sch_EnumerationValue, System.Xml.Schema.XmlSchemaDatatype.TokenizedType, System.value, and System.Xml.Schema.XmlSchemaDatatype.Variety.

Referenced by System.Xml.Schema.XdrBuilder.CheckDefaultAttValue().