Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











PROPERTY:  Document::documentElement

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.

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>

Code (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

Output:
fiction Eyeless in Gaza Aldous Huxley
classics John Barleycorn Jack London



 


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