XML DOM xmlEncoding 属性
定義と用法
xmlEncoding
属性はドキュメントのエンコーディングを返します。
構文
documentObject.xmlEncoding
例
以下のコードは "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; }