Chapter 5. The XML .NET Document Object Model

In addition to XML readers and writers, the Microsoft .NET Framework provides classes that parse XML documents according to the W3C Document Object Model (DOM) Level 1 Core and the DOM Level 2 Core. These classes, available in the System.Xml namespace, build a complete in-memory representation of the contents of an XML document and make it programmatically accessible during both read and write operations.

The structure of the XML Document Object Model (XML DOM) is a general specification that is implemented using platform-specific features and components. The MSXML library provides a COM-based XML DOM implementation for the Microsoft Win32 platform. The System.Xml assembly provides a .NET Framework–specific implementation of the XML DOM centered on the XmlDocument class.

Although it is stored as flat text in a linear text file, XML content is inherently hierarchical. Readers simply parse the text as it is read out of the input stream. They never cache read information and work in a stateless fashion. As a result of this arrangement, you can neither edit nodes nor move backward. The limited navigation capabilities also prevent you from implementing node queries of any complexity. The XML DOM philosophy is quite different. XML DOM loads all the XML content in memory and exposes it through a suite of collections that, overall, offer a tree-based representation of the original content. In addition, the supplied data structure is fully searchable and editable.

Advanced searching and editing are the primary functions of the XML DOM, whereas readers (and Simple API for XML [SAX] parsers as well) are optimized for document inspection, simple searching, and any sort of read-only activity. In Chapter 2, we explored the characteristics of pull mode readers. Let’s analyze now the .NET Framework programming interface for full-access XML document processing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.63.106