Latest web development tutorials

XML DOM ownerDocument property

Node Object Reference Node objects

Definition and Usage

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

grammar

nodeObject.ownerDocument


Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and returns the first <title> element of the root node:

Examples

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 objects