XML DOM cdata ဒေတာ ပိုင်ဆိုင်မှု
❮ CDATA အရာဝတ္ထု
ဥပမာ
အောက်ဖော်ပြပါ ကုဒ်အပိုင်းအစသည် " books_cdata.xml " ကို xmlDoc သို့ တင်ပြီး <html> ဒြပ်စင်များအားလုံးမှ ဒေတာကို ရယူသည်-
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET",
"books_cdata.xml", true);
xhttp.send();
function myFunction(xml) {
var x, i,
xmlDoc, txt;
xmlDoc = xml.responseXML;
txt = "";
x = xmlDoc.getElementsByTagName("html");
for (i =
0; i < x.length; i++) {
txt
+= x[i].childNodes[0].data + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}
အထက်ဖော်ပြပါ ကုဒ်၏ အထွက်သည်-
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
ဒေတာပိုင်ဆိုင်မှုသည် ရွေးချယ်ထားသော node ၏ဒေတာကို ပြန်ပေးသည်။
အထားအသို
CDATANode.data
❮ CDATA အရာဝတ္ထု