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.



Microsoft.NET Compact Framework Kick Start
Microsoft .NET Compact Framework Kick Start
ISBN: 0672325705
EAN: 2147483647
Year: 2003
Pages: 206

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net