XML DOM » Node » nodeValue

Syntax:
node.nodeValue

This property contains the value of the node, depending on type.

The nodeValue property contains the value of the node, depending on type. The values returned by each node type are detailed below.

Examples

Code:
XML:

<names>
   <name>Alice</name>
   <name>Bert</name>
   <name>Charlie</name>
   <name>Diane</name>
   <name>Eric</name>
</names>

VBScript:

Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("names.xml")

Set objNode = objXMLDoc.documentElement.lastChild
document.write(objNode.nodeValue)
Set objNode = objNode.firstChild
document.write("<br>" & objNode.nodeValue)
Output:
Eric
Null
Explanation:

This example uses the 'names.xml' file and obtains the node values of the last child node of the document's root node (the last 'name' tag), and that node's first child node (the text itself).

Language(s): VBScript XML