Atributo xmlVersion del DOM XML

Definición y uso

xmlVersion Establece o devuelve la versión XML del documento.

Sintaxis

documentObject.xmlVersion

Ejemplo

El siguiente código cargará "books.xml" en xmlDoc, mostrando la codificación XML del documento, la propiedad standalone y la versión XML:

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 =
    "Codificación XML: " + xmlDoc.xmlEncoding +
    "<br>XML independiente: " + xmlDoc.xmlStandalone +
    "<br>Version de XML: " + xmlDoc.xmlVersion +
    "<br>Encoding utilizado al analizar: " + xmlDoc.inputEncoding;
}

Prueba personalmente