CheckValidity()

XPathNavigator::CheckValidity(SharedPtr<System::Xml::Schema::XmlSchemaSet>, System::Xml::Schema::ValidationEventHandler) method

Verifies that the XML data in the XPathNavigator conforms to the XML Schema definition language (XSD) schema provided.

virtual bool System::Xml::XPath::XPathNavigator::CheckValidity(SharedPtr<System::Xml::Schema::XmlSchemaSet> schemas, System::Xml::Schema::ValidationEventHandler validationEventHandler)

Arguments

ParameterTypeDescription
schemasSharedPtr<System::Xml::Schema::XmlSchemaSet>The XmlSchemaSet containing the schemas used to validate the XML data contained in the XPathNavigator.
validationEventHandlerSystem::Xml::Schema::ValidationEventHandlerThe ValidationEventHandler that receives information about schema validation warnings and errors.

Return Value

true if no schema validation errors occurred; otherwise, false.

Exceptions

ExceptionDescription
XmlSchemaValidationExceptionA schema validation error occurred, and no ValidationEventHandler was specified to handle validation errors.
InvalidOperationExceptionThe XPathNavigator is positioned on a node that is not an element, attribute, or the root node or there is not type information to perform validation.
ArgumentExceptionThe method was called with an XmlSchemaSet parameter when the XPathNavigator was not positioned on the root node of the XML data.

See Also