In order to parse XML documents with DOM, we first need a method to generate a DOM implementation. With .NET the DOM implementation is called XmlDocument, which represents an entire parsed DOM document. The DOM implementation, however, is not its own parser. In fact, much like the XMLValidatingReader, it relies on a lower-level parser like the XmlTextReader to actually generate the parsed data for it. That's exactly what will be done in this example. First, an XmlTextReader is created for the example document.
XmlTextReader xmlReader = new XmlTextReader("example.xml");
Although XmlDocument does provide an implementation of the Document Object Model, many of the methods and properties have been changed to better ...