YouTip LogoYouTip

Prop Element Ownerdocument

# XML DOM ownerDocument Property * * Element Object Reference Manual](#) --- ## Definition and Usage The ownerDocument property returns the document object of the node (the top-level Document object). This property is read-only and returns the Document object to which the node belongs. --- ## Syntax node.ownerDocument --- ## Example The following code fragment loads the "[note.xml](#)" file into an xmlDoc object: ### Example

var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { myFunction(this); } }; xhttp.open("GET", "note.xml", true); xhttp.send(); function myFunction(xml) { var xmlDoc = xml.responseXML; var x = xmlDoc.getElementsByTagName("publisher"); document.getElementById("demo").innerHTML = "Publisher: " + x.childNodes.nodeValue + "
Owner Document: " + x.ownerDocument.nodeName; } **Output:** Publisher: W3School Owner Document: #document --- ## Related Pages (#) (#) (#) --- [Previous: XML DOM – Attr Object](#) | [Next: XML DOM – ProcessingInstruction Object](#) --- ## Comments [!(#)](#)[Learning XML DOM is Easy! - Click here to view more examples >>](#)
← Prop Element ParentnodeProp Element Nodetype β†’