Attribut xmlEncoding du DOM XML
Définition et utilisation
xmlEncoding
L'attribut retourne l'encodage du document.
Syntaxe
documentObject.xmlEncoding
Exemple
Le code suivant charge "books.xml" dans xmlDoc, affiche l'encodage XML, l'attribut standalone et la version 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 autonome : " + xmlDoc.xmlStandalone + "<br>Version XML : " + xmlDoc.xmlVersion + "<br>Encodage utilisé lors de l'analyse : " + xmlDoc.inputEncoding; }