Processing XML by Using the Document Object Model

So far we have discussed forward-only reading and writing of XML documents. The XML Document Object Model (XML DOM) creates an in-memory hierarchical view of the XML document that can be navigated in any direction. The XML DOM can be used to create, modify, and parse an XML document.

The XML DOM tree is made up of nodes. In the .NET Compact Framework, these nodes are represented by an abstract class named XmlNode. Each type of node is represented by an implementation of the XmlNode class. For instance, an element node is represented by the XmlElement class, which implements the XmlNode abstract class.

The XmlDocument class represents the very top of the XML DOM tree. The nodes underneath the XmlDocument node are arranged in a hierarchal structure made up mostly of parent-child relationships. Some relationships, such as element-attribute relationships, are considered container-contained relationships. The XmlDocument has a property named DocumentElement that represents the “root” element of the node tree. This node is incredibly useful for jumping directly to the root node and skipping over the prolog. The XmlNode class provides methods for navigating each of its child nodes.

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

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