Re: XML Tips The XML DOM
The XML DOM (XML Document Object Model) defines a standard way for accessing and manipulating XML documents.
The DOM views XML documents as a tree-structure. All elements can be accessed through the DOM tree. Their content (text and attributes) can be modified or deleted, and new elements can be created. The elements, their text, and their attributes are all known as nodes.
In the example below we use the following DOM reference to get the text from the <to> element:
xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue
* xmlDoc - the XML document created by the parser.
* getElementsByTagName("to")[0] - the first <to> element
* childNodes[0] - the first child of the <to> element (the text node)
* nodeValue - the value of the node (the text itself)
__________________ V.Vadivelan There never a wrong time to do the right thing. |