Attributo xmlStandalone del DOM XML
Definizione e uso
xmlStandalone
L'attributo imposta o restituisce se il documento è indipendente.
Sintassi
documentObject.xmlStandalone
Esempio
Esempio di codice che carica "books.xml" nel 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 独立: " + xmlDoc.xmlStandalone + "<br>XML 版本: " + xmlDoc.xmlVersion + "<br>在解析时使用的编码: " + xmlDoc.inputEncoding; }