XML DOM ပိုင်ရှင်Document Property
❮ Attr Object
ဥပမာ
အောက်ဖော်ပြပါ ကုဒ်အပိုင်းအစသည် " books.xml " ကို xmlDoc တွင် တင်ပြီး ပထမအမျိုးအစား attribute node ၏ root element ကို ပြန်ပို့ပေးသည်-
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('book');
document.getElementById("demo").innerHTML =
x.item(0).attributes[0].ownerDocument
+ "<br>" +
x.item(0).attributes[0].ownerDocument.nodeName
+ "<br>" +
x.item(0).attributes[0].ownerDocument.nodeType;
}
အထက်ဖော်ပြပါ ကုဒ်၏ အထွက်သည်-
[object XMLDocument]
#document
9
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
ownerDocument property သည် node တစ်ခုအတွက် root element (document object) ကို ပြန်ပေးသည်။
အထားအသို
attrObject.ownerDocument
❮ Attr Object