XML DOM documentElement Property
❮ စာရွက်စာတမ်းအရာဝတ္ထု
ဥပမာ
အောက်ဖော်ပြပါ ကုဒ်အပိုင်းအစသည် " books.xml " ကို xmlDoc သို့ တင်ပြီး XML စာရွက်စာတမ်း၏ တည်နေရာကို ပြသသည်-
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.documentElement;
document.getElementById("demo").innerHTML
=
"Nodename: " + x.nodeName + "<br>" +
"Nodevalue: " + x.nodeValue + "<br>" +
"Nodetype: " +
x.nodeType;
}
အထွက်-
Nodename: bookstore
Nodevalue: null
Nodetype: 1
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
documentElement ပိုင်ဆိုင်မှုသည် document ၏ root node ကို ပြန်ပေးသည်။
အထားအသို
documentObject.documentElement
❮ စာရွက်စာတမ်းအရာဝတ္ထု