Xmlvalidatingreader is obsolete use xmlreader
Its not guaranteed foolproof, but I have used this to find errors in my schemas.
This class implements Xml Reader and conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.If this property is set, and if schema validation is requested, then validation will fail unless the outermost element of the document has the required name.This option requires the schema-aware version of the Saxon product (Saxon-SA).They both seem to output a warning when the xml is missing a DOCTYPE which halts validation.This one takes in the schemas as strings (file resources within the assembly) and adds them to a schema set. If the xml isn't found to be invalid, I do a negative check to make sure my schemas aren't screwed up.Load an XML document, delivered using an Xml Reader.
The Xml Reader is responsible for parsing the document; this method builds a tree representation of the document (in an internal Saxon format) and returns its document node.
This setting applies to schema validating Xml Reader objects (Xml Reader Settings.
Create method is the preferred mechanism for obtaining Xml Reader instances. A non-zero value specifies the maximum size, in characters. Gets or sets a value indicating the schema validation settings.
Take a look at the stock Xml Reader and Xml Reader Settings which contains some Validation properties to define the behavior.
This article explained about the XML document, XSD schema, and how to validate XML document against XSD schema using Microsoft .
Line numbers are maintained only for element nodes; the line number returned for any other node will be that of the most recent element.