Proprietà xmlVersion del DOM XML
Definizione e uso
xmlVersion
Imposta o restituisce la versione XML del documento.
Sintassi
documentObject.xmlVersion
Esempio
Esempio di codice che carica "books.xml" in xmlDoc, mostrando l'encoding XML, l'attributo standalone e la versione 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 = "XML encoding: " + xmlDoc.xmlEncoding + "<br>XML standalone: " + xmlDoc.xmlStandalone + "<br>Versione XML: " + xmlDoc.xmlVersion + "<br>Encoding utilizzato durante l'analisi: " + xmlDoc.inputEncoding; }