Validates the System.Xml.XmlDocument against the XML Schema Definition Language (XSD) schemas contained in the XmlDocument.Schemas property.
- validationEventHandler
- The System.Xml.Schema.ValidationEventHandler object that receives information about schema validation warnings and errors.
The XmlDocument.Validate(System.Xml.Schema.ValidationEventHandler) method validates the XML data in the System.Xml.XmlDocument against the schemas contained in the XmlDocument.Schemas property. The XmlDocument.Validate(System.Xml.Schema.ValidationEventHandler) method performs infoset augmentation. Specifically, after successful validation, schema defaults are applied, text values are converted to atomic values as necessary, and type information is associated with validated information items. The result is a previously un-typed XML sub-tree in the System.Xml.XmlDocument replaced with a typed sub-tree.
The following are important notes to consider when using the XmlDocument.Validate(System.Xml.Schema.ValidationEventHandler) method.
Schema location hints like xsi:schemaLocation or xsi:noNamespaceSchemaLocation are ignored.
Inline schemas are ignored.
If schema validation errors occur during validation the System.Xml.XmlDocument becomes partially validated with some nodes with correct type information and some without.
The validation process includes checking for uniqueness and reference constraints (xs:ID, xs:IDREF, xs:key, xs:keyref, and xs:unique).