XML DOM appendData() နည်းလမ်း
❮ 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 xmlDoc = xml.responseXML;
var x =
xmlDoc.getElementsByTagName("html")[0].childNodes[0];
x.appendData(" Wonderful!");
document.getElementById("demo").innerHTML =
x.data;
}
အထွက်-
Stunning! Wonderful!
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
appendData() နည်းလမ်းသည် CDATA node တစ်ခု၏အဆုံးတွင် ဒေတာကို ပေါင်းထည့်သည်။
အထားအသို
CDATANode.appendData(string)
Parameter | Description |
---|---|
string | Required. The string to add to the CDATA node |
❮ CDATA အရာဝတ္ထု