خصائص data XML DOM
التعريف والاستخدام
data
يضبط أو يعيد القيمة النصية للعنصر أو الخاصية.
النحو
textNode.data
مثال
الآتي يحمّل "books.xml" إلى xmlDoc ويخرج النص من العنصر الأول <title>:
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("title")[0].childNodes[0]; document.getElementById("demo").innerHTML = x.data; }