Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM ownerDocument Property

XML DOM ownerDocument Property


Node Object Reference Node object


Definition and Usage

The ownerDocument property returns the root element (document object) of a node.

Syntax

nodeObject.ownerDocument


Example

The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc, and return whether the first root element of the node: </p>

Example

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName("title")[0].ownerDocument;

document.write("Nodename: " + x.nodeName);

document.write(" (nodetype: " + x.nodeType + ")");

The code above will output:

Nodename: #document (nodetype: 9)

Try it »


Node Object Reference Node object