XML DOM Node Information
In this article I am going to explain about XML DOM Node Information.
DOM Node Information in XML
XML DOM Node is an object. That contain Method and properties. DOM object have three properties that contain information about node. That is following.
nodeName (Contain node name information)
nodeName properties
- nodename of element node it is same name as a tag.
- nodeName is Readonly.
- nodeName of text node always # node.
nodeValue (Contain node value information)
nodeValue properties
- nodeValue Undefined foe Element node.
- nodeValue text itself for text nodes.
nodeType (Contain node Type information)
nodeType properties
- nodeType properties specified the type of node.
- Its only Read only.
Example
How to retrive text nodeValue of "Name" element.
Doce=loadXMLDoc("Detail.xml");
ss=Doce.getElementsByTagName("Name")[0].childNodes[0];
str=ss.nodeValue;
|
How to change value of element.
Doce=loadXMLDoc("Detail.xml");
ss=Doce.getElementsByTagName("Name")[0].childNodes[0];
ss.nodeValue="Hello";
|
Further Readings
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here