XML DOM xmlStandalone 属性

定義と用法

xmlStandalone 属性は、ドキュメントが独立しているかどうかを設定または返します。

文法

documentObject.xmlStandalone

以下のコードは "books.xml" を xmlDoc にロードし、ドキュメントの XML エンコーディング、standalone 属性、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エンコーディング: " + xmlDoc.xmlEncoding +"
    "<br>XML 独立: " + xmlDoc.xmlStandalone +
    "<br>XML バージョン: " + xmlDoc.xmlVersion +
    "<br>パース時に使用されたエンコーディング: " + xmlDoc.inputEncoding;
}

実際に試してみる