Introduction to XML Document Object Model - Covering Our Base
(Page 2 of 5 )
Base Objects
In order to represent the hierarchical nature of XML, the DOM provides a whole set of objects, methods and properties that allow us to manipulate the DOM. We will not be able to cover them all in this tutorial, but we’ll cover a few to give you the essence of the sort of things you can achieve. First and foremost let’s see the DOM objects:
| Object | Description |
| Node | A single node in the hierarchy |
| NodeList | A collection of Nodes |
| NameNodeMap | A collection of nodes allowing access by name as well as index. |
There are vast numbers of DOM properties that allow us to traverse through the node. The following list gives a few properties. We will sample these DOM objects later.
| Properties | Description |
| parentNode | Returns the parent of the current node. |
| childNodes | Returns a NodeList containing the children of the node. |
| firstChild | Returns the first child of the current node. |
| lastName | Returns the last child of the current node. |
| previousSibling | Returns the previous sibling, i.e. the previous node at the same level of the hierarchy. |
| nextSibling | Returns the next sibling, i.e. the next node at the same level of the hierarchy. |
| nodeName | Returns the name of the node. |
| nodeValue | Returns the value of the node. |
To get the full list, check out MSDN online XML area at msdn.microsoft.com/xml/.
Next: DOM Simplified >>
More XML Articles
More By Gayathri Gokul