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

◆ CheckXsiTypeAndNil()

SchemaElementDecl System.Xml.Schema.XmlSchemaValidator.CheckXsiTypeAndNil ( SchemaElementDecl elementDecl,
string xsiType,
string xsiNil,
ref bool declFound )
inlineprivate

Definition at line 1559 of file XmlSchemaValidator.cs.

1560 {
1561 XmlQualifiedName xmlQualifiedName = XmlQualifiedName.Empty;
1562 if (xsiType != null)
1563 {
1564 object typedValue = null;
1565 Exception ex = s_dtQName.TryParseValue(xsiType, _nameTable, _nsResolver, out typedValue);
1566 if (ex != null)
1567 {
1568 SendValidationEvent(System.SR.Sch_InvalidValueDetailedAttribute, new string[4] { "type", xsiType, s_dtQName.TypeCodeString, ex.Message }, ex);
1569 }
1570 else
1571 {
1572 xmlQualifiedName = typedValue as XmlQualifiedName;
1573 }
1574 }
1575 if (elementDecl != null)
1576 {
1577 if (elementDecl.IsNillable)
1578 {
1579 if (xsiNil != null)
1580 {
1581 _context.IsNill = XmlConvert.ToBoolean(xsiNil);
1582 if (_context.IsNill && elementDecl.Presence == SchemaDeclBase.Use.Fixed)
1583 {
1585 }
1586 }
1587 }
1588 else if (xsiNil != null)
1589 {
1591 }
1592 }
1593 if (xmlQualifiedName.IsEmpty)
1594 {
1595 if (elementDecl != null && elementDecl.IsAbstract)
1596 {
1598 elementDecl = null;
1599 }
1600 }
1601 else
1602 {
1605 if (HasSchema && _processContents == XmlSchemaContentProcessing.Strict)
1606 {
1607 severity = XmlSeverityType.Error;
1608 }
1609 if (schemaElementDecl == null && xmlQualifiedName.Namespace == _nsXs)
1610 {
1611 XmlSchemaType xmlSchemaType = DatatypeImplementation.GetSimpleTypeFromXsdType(xmlQualifiedName);
1612 if (xmlSchemaType == null)
1613 {
1614 xmlSchemaType = XmlSchemaType.GetBuiltInComplexType(xmlQualifiedName);
1615 }
1616 if (xmlSchemaType != null)
1617 {
1618 schemaElementDecl = xmlSchemaType.ElementDecl;
1619 }
1620 }
1621 if (schemaElementDecl == null)
1622 {
1624 elementDecl = null;
1625 }
1626 else
1627 {
1628 declFound = true;
1629 if (schemaElementDecl.IsAbstract)
1630 {
1632 elementDecl = null;
1633 }
1634 else if (elementDecl != null && !XmlSchemaType.IsDerivedFrom(schemaElementDecl.SchemaType, elementDecl.SchemaType, elementDecl.Block))
1635 {
1637 {
1638 xmlQualifiedName.ToString(),
1639 QNameString(_context.LocalName, _context.Namespace)
1640 });
1641 elementDecl = null;
1642 }
1643 else
1644 {
1645 if (elementDecl != null)
1646 {
1652 }
1655 }
1656 }
1657 }
1658 return elementDecl;
1659 }
static string Sch_XsiTypeNotFound
Definition SR.cs:602
static string Sch_InvalidXsiNill
Definition SR.cs:874
static string Sch_AbstractElement
Definition SR.cs:870
static string Sch_XsiTypeAbstract
Definition SR.cs:604
static string Sch_InvalidValueDetailedAttribute
Definition SR.cs:488
static string Sch_XsiTypeBlockedEx
Definition SR.cs:872
static string Sch_XsiNilAndFixed
Definition SR.cs:1120
Definition SR.cs:7
SchemaElementDecl GetTypeDecl(XmlQualifiedName qname)
static readonly XmlSchemaDatatype s_dtQName
XmlSchemaContentProcessing _processContents
static string QNameString(string localName, string ns)
readonly IXmlNamespaceResolver _nsResolver

References System.Xml.Schema.XmlSchemaValidator._compiledSchemaInfo, System.Xml.Schema.XmlSchemaValidator._context, System.Xml.Schema.XmlSchemaValidator._nameTable, System.Xml.Schema.XmlSchemaValidator._nsResolver, System.Xml.Schema.XmlSchemaValidator._nsXs, System.Xml.Schema.XmlSchemaValidator._processContents, System.Xml.Dictionary, System.Xml.XmlQualifiedName.Empty, System.Xml.Schema.XmlSchemaType.GetBuiltInComplexType(), System.Xml.Schema.DatatypeImplementation.GetSimpleTypeFromXsdType(), System.Xml.Schema.SchemaInfo.GetTypeDecl(), System.Xml.Schema.XmlSchemaValidator.HasSchema, System.Xml.Schema.XmlSchemaType.IsDerivedFrom(), System.Xml.Schema.ValidationState.IsNill, System.Xml.Schema.ValidationState.LocalName, System.Xml.Schema.ValidationState.Namespace, System.Xml.Schema.XmlSchemaValidator.QNameString(), System.Xml.Schema.XmlSchemaValidator.s_dtQName, System.SR.Sch_AbstractElement, System.SR.Sch_InvalidValueDetailedAttribute, System.SR.Sch_InvalidXsiNill, System.SR.Sch_XsiNilAndFixed, System.SR.Sch_XsiTypeAbstract, System.SR.Sch_XsiTypeBlockedEx, System.SR.Sch_XsiTypeNotFound, System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(), and System.Xml.XmlConvert.ToBoolean().

Referenced by System.Xml.Schema.XmlSchemaValidator.ValidateElement().