PROPERTY:  Document::documentElement


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.

The example that follows first 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.

      <title>Eyeless in Gaza</title>
      <author>Aldous Huxley</author>
      <title>John Barleycorn</title>
      <author>Jack London</author>

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False

Dim root, i
Set root = objXMLDoc.documentElement
For i = 0 To (root.childNodes.length)
   document.write(root.childNodes.item(i).text & "<br>")

fiction Eyeless in Gaza Aldous Huxley
classics John Barleycorn Jack London

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information