XML DOM ownerDocumentProperty


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 usesloadXMLDoc()put "books.xml" Load into xmlDoc and return the root element of the first <title> node:"

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 Yourself »

Node objectother extensions