Basically XML documents are validated by the Xml Reader class Create method. This method hold 2 arguments, one is the XML file path & another one is the Xml Reader Settings object which contains the XML schema definition language (XSD) schema.
Click here to read the process from my another article.
This program validates the XML document against the schema successfully.
However, when the user selects the XML document catalog1.xml, validation fails for the book element in the lines containing more than one title element.
When the program encounters the invalid node, the method Validation Error is called that displays a message explaining why validation failed. An object of the class Xml Schema Set stores a collection of schemas that an Xml Reader can be validated against.
It assigns a new Xml Schema Set object to variable schemas, and calls this object's Add method to add a schema to the collection.