XML DOM nodeValue Property
Definition and Usage
The nodeValue property can set or return the value of a node based on its type.
Syntax:
nodeObject.nodeValue
Example
In all examples, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
The following code snippet can display the node name and node value of the root node:
xmlDoc=loadXMLDoc("books.xml");
document.write("Nodename: ")
document.write(" (value: ") xmlDoc.childNodes[0].nodeValue
);
Output:
Nodename: #document (value: version="1.0" encoding="ISO-8859-1"