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

◆ CheckValue()

void System.Xml.Schema.XdrValidator.CheckValue ( string value,
SchemaAttDef attdef )
inlineprivate

Definition at line 434 of file XdrValidator.cs.

435 {
436 try
437 {
439 bool flag = attdef != null;
440 XmlSchemaDatatype xmlSchemaDatatype = (flag ? attdef.Datatype : context.ElementDecl.Datatype);
441 if (xmlSchemaDatatype == null)
442 {
443 return;
444 }
445 if (xmlSchemaDatatype.TokenizedType != 0)
446 {
447 value = value.Trim();
448 }
449 if (value.Length == 0)
450 {
451 return;
452 }
453 object obj = xmlSchemaDatatype.ParseValue(value, base.NameTable, _nsManager);
457 {
458 if (xmlSchemaDatatype.Variety == XmlSchemaDatatypeVariety.List)
459 {
460 string[] array = (string[])obj;
461 for (int i = 0; i < array.Length; i++)
462 {
464 }
465 }
466 else
467 {
468 ProcessTokenizedType(xmlSchemaDatatype.TokenizedType, (string)obj);
469 }
470 }
471 SchemaDeclBase schemaDeclBase = (flag ? ((SchemaDeclBase)attdef) : ((SchemaDeclBase)context.ElementDecl));
472 if (schemaDeclBase.MaxLength != uint.MaxValue && value.Length > schemaDeclBase.MaxLength)
473 {
475 }
476 if (schemaDeclBase.MinLength != uint.MaxValue && value.Length < schemaDeclBase.MinLength)
477 {
479 }
480 if (schemaDeclBase.Values != null && !schemaDeclBase.CheckEnumeration(obj))
481 {
482 if (xmlSchemaDatatype.TokenizedType == XmlTokenizedType.NOTATION)
483 {
485 }
486 else
487 {
489 }
490 }
491 if (!schemaDeclBase.CheckValue(obj))
492 {
493 if (flag)
494 {
496 }
497 else
498 {
500 }
501 }
502 }
503 catch (XmlSchemaException)
504 {
505 if (attdef != null)
506 {
508 }
509 else
510 {
512 }
513 }
514 }
static string Sch_AttributeValueDataType
Definition SR.cs:1808
static string Sch_ElementValueDataType
Definition SR.cs:1810
static string Sch_FixedElementValue
Definition SR.cs:494
static string Sch_MinLengthConstraintFailed
Definition SR.cs:688
static string Sch_FixedAttributeValue
Definition SR.cs:492
static string Sch_EnumerationValue
Definition SR.cs:568
static string Sch_MaxLengthConstraintFailed
Definition SR.cs:690
static string Sch_NotationValue
Definition SR.cs:566
Definition SR.cs:7
void SendValidationEvent(string code)
void ProcessTokenizedType(XmlTokenizedType ttype, string name)
XmlNamespaceManager _nsManager

References System.Xml.Schema.XdrValidator._nsManager, System.array, System.Xml.Schema.BaseValidator.context, System.Xml.Schema.SchemaDeclBase.Datatype, System.Xml.Dictionary, System.Xml.Schema.ValidationState.ElementDecl, System.Xml.Schema.ValidationState.LocalName, System.Xml.Schema.ValidationState.Namespace, System.obj, System.Xml.Schema.XmlSchemaDatatype.ParseValue(), System.Xml.Schema.XdrValidator.ProcessTokenizedType(), System.Xml.Schema.XmlSchemaValidator.QNameString(), System.SR.Sch_AttributeValueDataType, System.SR.Sch_ElementValueDataType, System.SR.Sch_EnumerationValue, System.SR.Sch_FixedAttributeValue, System.SR.Sch_FixedElementValue, System.SR.Sch_MaxLengthConstraintFailed, System.SR.Sch_MinLengthConstraintFailed, System.SR.Sch_NotationValue, System.Xml.Schema.BaseValidator.SendValidationEvent(), and System.value.

Referenced by System.Xml.Schema.XdrValidator.ValidateEndElement(), and System.Xml.Schema.XdrValidator.ValidateStartElement().