documentElement Property
Retrieves the root element node of the document.

var oRootElement = document.documentElement;

Possible Values
oRootElement A reference to the root document element.

A valid XML document contains a single root document element. The documentElement property returns a reference to that node in the DOM.

The example below utilizes the following sample data describing a stock quote. In this sample data, "quote" is the name of the root document element.

<?xml version="1.0"?>
<?access-control allow="*"?>
   <name>Ford Motor Company</name>

The following example uses the documentElement property to assign a reference to the root document element to an ECMAScript variable. The code then iterates through the root document element for nodes named "name" and "last". It reads the values contained within these nodes back to the user.

<vxml version="2.0">
   <data name="oQuote" src="quote.exml"/>
      var oRoot = oQuote.documentElement;
      // retrieve the company name and price per share
      var sCoName = "unknown", fLast = 0.0;
      for (var iChild = 0; iChild < oRoot.childNodes.length; iChild++)
         var oChild = oRoot.childNodes.item(iChild);
         if ("name" == oChild.nodeName)
            sCoName =;
         else if ("last" == oChild.nodeName)
            fLast = parseFloat(, 10);
   <form id="read_quote">
      <audio><value expr="sCoName"/> is currently at <value expr="fLast"/></audio>

Applies To
[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers