Propiedad nodeValue del XML DOM
Definición y uso
nodeValue
Establece o devuelve el valor del nodo, según su tipo.
Sintaxis
documentObject.nodeValue
Ejemplo
El siguiente código cargará "books.xml" en xmlDoc y mostrará el nombre y el valor del nodo raíz:
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; document.getElementById("demo").innerHTML = "Nodename: " + xmlDoc.nodeName + (value: " + xmlDoc.childNodes[0].nodeValue) + ")"; }