XML DOMdocumentURIプロパティ
❮ドキュメントオブジェクト
例
次のコードフラグメントは、「books.xml」をxmlDocにロードし、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
=
"Document location: " + xmlDoc.documentURI;
}
出力:
Document location: https://www.w3schools.com/xml/books.xml
定義と使用法
documentURIプロパティは、ドキュメントの場所を設定または返します。
構文
documentObject.documentURI
❮ドキュメントオブジェクト