In MSXML 5.0 and later, there are two ways to validate XML data against a set of XML Schema definitions. One uses the validate
method on an XML DOM instance to validate the entire DOM object. The other uses the validateNode(node)
method on a DOM instance to validate a DOM fragment. A DOM fragment is a sub-tree rooted at the specified node.
The example in this tutorial illustrates both of these methods. This project uses or creates the following files.
Component | Description |
---|---|
Source: validateDOM.cpp | Validates an XML file against an XSD schema. |
Resource: books.xml and books.xsd | An XML data file and an XSD schema file. |
Output | When you build and run the validateDOM project, you should get this output in a console window. |
To create the validateDOM project in Visual C++
Next, we'll add the source code for the validateDOM project.