XML DOM အရှည် ပိုင်ဆိုင်မှု
❮ အမည်ရှိNodeMap Object
ဥပမာ
အောက်ဖော်ပြပါ ကုဒ်အပိုင်းအစသည် " books.xml " ကို xmlDoc ထဲသို့ တင်ပြီး ပထမ <book> ဒြပ်စင်ရှိ အရည်အချင်းအရေအတွက်ကို ရယူသည်-
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 =
"Number of
attributes in the first book element: " +
x.item(0).attributes.length;
}
အထက်ဖော်ပြပါ ကုဒ်၏ အထွက်သည်-
Number of attributes in the first book element:
1
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
အရှည် ပိုင်ဆိုင်မှုသည် NamedNodeMap အတွင်းရှိ node အရေအတွက်ကို ပြန်ပေးသည်။
အထားအသို
nodemapObject.length
ကိုယ်တိုင်စမ်းသုံးကြည့်ပါ-ဒီမိုများ
❮ အမည်ရှိNodeMap Object