This property contains the root element for the document.
The documentElement property exists for convenient access to the root element of the document. It returns an Element object, or null if no root element exists.
XML:
<library>
<book>
<category>fiction</category>
<title>Eyeless in Gaza</title>
<author>Aldous Huxley</author>
</book>
<book>
<category>classics</category>
<title>John Barleycorn</title>
<author>Jack London</author>
</book>
</library>
VBScript:
Set objXMLDoc =
CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("library.xml")
Dim root, i
Set root = objXMLDoc.documentElement
For i = 1 To (root.childNodes.length)
document.write(root.childNodes.item(i).text &
"<br>")
Next
fiction Eyeless in Gaza Aldous Huxley
classics John Barleycorn Jack London
This example loads the 'library.xml' file, and then creates an Element object from the documentElement property and iterates through its child nodes, printing the text of each.