DOM (Document Object Model)
The Document Object Model (DOM) class is an in-memory representation of an XML document. The DOM allows you to programmatically read, manipulate, and modify 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. In DOM, a XML document is represented as a Tree Structure. Each circle in the above structure is known as a Node also known as XmlNode object. The XmlNode object is the basic object in the DOM tree. The XmlDocument class, which extends XmlNode The XmlDocument class provides a means to view and manipulate the nodes in the entire XML document.
In the DOM structure(Tree structure), there are mainly 12 different types of XmlNodes, that can be categorized as
1. Nodes that can have child nodes, 2. Nodes that can’t have child nodes.
Nodes that can have child nodes are:
Document DocumentFragment EntityReference Element Attribute
Nodes that can’t have child nodes are: XmlDeclaration Notation Entity CDATASection Text Comment ProcessingInstruction DocumentType
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.
|
| Author: Hema Kumar 17 Jul 2004 | Member Level: Silver Points : 0 |
Artical is very simple and easy to Understand.Keep it up.Come up with more articles
|