O'Reilly logo

Special Edition Using XML, Second Edition by - et al. David Gulbransen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a DOM Implementation

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"); 

Note

Although XmlDocument does provide an implementation of the Document Object Model, many of the methods and properties have been changed to better ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required