الثلاثاء، 10 فبراير 2009

XML Document Object Model

XML Document Object Model
The XML DOM provides an interface for programmers to create XML documents; to navigate them; and to add, modify, or delete parts of those XML documents while they are held in memory
The XML Document Object Model (DOM) class is an in-memory representation of an XML document
The XmlReader class also reads XML; however, it provides non-cached, forward-only, read-only access. This means that there are no capabilities to edit the values of an attribute or content of an element, or the ability to insert and remove nodes with the XmlReader
Editing is the primary function of the DOM. It is the common and structured way that XML data is represented in memory, although the actual XML data is stored in a linear fashion when in a file or coming in from another object. The following is XML data

Input

The following illustration shows how memory is structured when this XML data is read into the DOM structure

XML document structure



The DOM is most useful for reading XML data into memory to change its structure, to add or remove nodes, or to modify the data held by a node as in the text contained by an element. However, other classes are available that are faster than the DOM in other scenarios. For fast, non-cached, forward-only stream access to XML, use the XmlReader and XmlWriter. If you need random access with a cursor model and XPath, use the XPathNavigator class.

0 التعليقات: