Export (0) Print
Expand All

Extensions Class

This class contains the LINQ to XML extension methods for XSD validation.

System::Object
  System.Xml.Schema::Extensions

Namespace:  System.Xml.Schema
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

[ExtensionAttribute]
public ref class Extensions abstract sealed

  NameDescription
Public methodStatic memberGetSchemaInfo(XAttribute)Gets the post-schema-validation infoset (PSVI) of a validated attribute.
Public methodStatic memberGetSchemaInfo(XElement)Gets the post-schema-validation infoset (PSVI) of a validated element.
Public methodStatic memberValidate(XDocument, XmlSchemaSet, ValidationEventHandler)This method validates that an XDocument conforms to an XSD in an XmlSchemaSet.
Public methodStatic memberValidate(XAttribute, XmlSchemaObject, XmlSchemaSet, ValidationEventHandler)This method validates that an XAttribute conforms to a specified XmlSchemaObject and an XmlSchemaSet.
Public methodStatic memberValidate(XDocument, XmlSchemaSet, ValidationEventHandler, Boolean)Validates that an XDocument conforms to an XSD in an XmlSchemaSet, optionally populating the XML tree with the post-schema-validation infoset (PSVI).
Public methodStatic memberValidate(XElement, XmlSchemaObject, XmlSchemaSet, ValidationEventHandler)This method validates that an XElement sub-tree conforms to a specified XmlSchemaObject and an XmlSchemaSet.
Public methodStatic memberValidate(XAttribute, XmlSchemaObject, XmlSchemaSet, ValidationEventHandler, Boolean)Validates that an XAttribute conforms to a specified XmlSchemaObject and an XmlSchemaSet, optionally populating the XML tree with the post-schema-validation infoset (PSVI).
Public methodStatic memberValidate(XElement, XmlSchemaObject, XmlSchemaSet, ValidationEventHandler, Boolean)Validates that an XElement sub-tree conforms to a specified XmlSchemaObject and an XmlSchemaSet, optionally populating the XML tree with the post-schema-validation infoset (PSVI).
Top

This class also contains methods to get the post-schema-validation infoset (PSVI) of a validated XML node.

When you validate an XDocument, XElement, or XAttribute, you can also optionally populate the XML tree with the post-schema-validation infoset. PSVI information is added as an annotation of type System.Xml.Schema::XmlSchemaInfo.

The XSD in Sample XSD File: Customers and Orders contains a schema that can be used to validate the XML document in Sample XML File: Customers and Orders (LINQ to XML). The following example loads the schema and the document, validates the document, changes the document so that the xs:key and xs:keyref relationship is not valid, and then attempts to validate again.

No code example is currently available or this language may not be supported.

This example produces the following output:

Validating custOrd
custOrd validated

Validating custOrd
The key sequence 'AAAAA' in Keyref fails to refer to some key.
custOrd did not validate

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft