XML DOM nodeType သုံးပါး

အသုံးပြုနည်း နှင့် အဆို

nodeType သုံးပါး ကုဒ် ကို သည် အကို ကွင်း ကို ကုန်းသိမ်းပါ

ပြောဉ်ပုံ:

attrObject.nodeType

အကျိုးသုံး

အားလုံး အမှတ်အသားများတွင် ကျမ်းစာအချက်အလက်များ အသုံးပြုပါမည် books.xmlနှင့် ဂျူးစတာ ဖောင်ဒေါ် loadXMLDoc()}

အောက်ပါ ကြောင်းပါ သည် category အခွင့်အရေး အမှုဆေး ကို ပြသခြင်း အရာများ ကို ပြသထားသည်:

xmlDoc=loadXMLDoc("/example/xdom/books.xml");
var x=xmlDoc.getElementsByTagName('book');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].nodeName);
document.write(" = ");
document.write(x.item(i).attributes[0].nodeValue);
document.write(" (nodetype: ");
document.write(x.item(i).attributes[0].nodeType + ")");
document.write("<br />");
}

အရေးယူထားသော ကြောင်းပါ:

category = children (nodetype: 2)
category = cooking (nodetype: 2)
category = web (nodetype: 2)
category = web (nodetype: 2)