XML DOM ownerDocument అనే స్పష్టం చేస్తుంది.

నిర్వచనం మరియు ఉపయోగం

ownerDocument అంశం యొక్క అధిపతి డాక్యుమెంట్ అనే స్పష్టం చేస్తుంది.

సంకేతం

elementNode.ownerDocument

ప్రతిస్పందన

ఈ కోడు "books.xml" ని xmlDoc లో లోడ్ చేస్తుంది మరియు మొదటి <title> ఎలమెంట్ యొక్క యజమాని డాక్యుమెంట్ నుండి పేరు మరియు నోడ్ టైప్ పొందుతుంది:

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
   if (this.readyState == 4 && this.status == 200) {
       myFunction(this);
   }
};
xhttp.open("GET", "books.xml", true);
xhttp.send();
function myFunction(xml) {
    var xmlDoc = xml.responseXML;
    var x = xmlDoc.getElementsByTagName("title")[0].ownerDocument;
    document.getElementById("demo").innerHTML =
    "Nodename: " + x.nodeName +
    " (nodetype: " + x.nodeType + ")"
}

亲自试一试