XML DOM documentElementProperty


Document object

Definition and Usage

The documentElement property returns the root node of the document.

Syntax

documentObject.documentElement


Example

The following code snippet usesloadXMLDoc()put "books.xmlLoad it into xmlDoc and display the location of the XML document:

Example

xmlDoc=loadXMLDoc("books.xml"); x=xmlDoc.documentElement; document.write("Nodename: " + x.nodeName + "<br>"); document.write("Nodevalue: " + x.nodeValue + "<br>"); document.write("Nodetype: " + x.nodeType);

Output:

Nodename: bookstore
Nodevalue: null
Nodetype: 1

Try it Yourself »

Document objectother extensions