It seems like validating an XML document against a schema would be a pretty simple thing to do in the .
Net framework, seeing as how they have such deep support for dealing with XML.
The programming interface of the Xml Validating Reader class does not explicitly provide for a single method good at validating the whole content of a document.
Errors in XML documents will stop your XML applications.
You can use the Xml Validating Reader class to validate entire XML documents as well as XML fragments.
The class works on top of an XML reader—typically an instance of the Xml Text Reader class.
But as of yet, I haven’t found a simple way to do it.
The reason is that XML software should be small, fast, and compatible.
The following example validates that the XML document from Sample XML File: Customers and Orders (LINQ to XML) is valid per the schema from Sample XSD File: Customers and Orders. This example uses the following XML document: Sample XML File: Customers and Orders (LINQ to XML).
After the change, orders will then refer to a customer that does not exist, so the XML document will no longer validate.
In certain scenarios, it is important to be able to compare two XML trees for equivalence.
For example, if you are writing a web service that serves results of queries, and you want to cache query results so that duplicate queries use previously cached results instead of always accessing the underlying database.