The Validation Type property of the Xml Reader Settings object is set to to enforce validation of the XML document by the Create method of the Xml Reader object.
A Validation Event Handler is added to the Xml Reader Settings object to handle any Warning or Error events raised by errors found during the validation process of both the XML document and the schema.[!
If you want to validate an XML document against a DTD that is not referenced by the document itself, you can use the keyword argument to parse from a file.
If a document is valid, a successful validation message is displayed in the Messages window.An individual schema or a set of schemas (as an Xml Schema Set) can be added to an Xml Schema Set by passing either one as a parameter to the Add method of Xml Schema Set.Note that when validating a document the target namespace of the document must match the target namespace of the schema in the schema set. CODE [XSDInference Examples#5](../Code Snippet/VS_Snippets_Data/XSDInference Examples#5)]The following is the schema that validates the example XML document.[!Otherwise, a message that describes the error is displayed.You can click on the links in the error message to jump to the node in the XML document where the error was found.Now that the program is ready to validate with an XML Schema definition, it is necessary only to ensure that the XML document is associated with (at least) one.