XML DOM nodeValue attribute

Document object reference manual

Definition and usage

The nodeValue attribute can be set or returned for a node value according to the node type.

Syntax:

documentObject.nodeValue

Example

In all examples, we will use the XML file books.xml, as well as 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: " + xmlDoc.nodeName);
document.write(" (value: ") xmlDoc.childNodes[0].nodeValue);

Output:

Nodename: #document (value: version="1.0" encoding="ISO-8859-1"

Document object reference manual