Vlastnost XML DOM documentURI
❮ Objekt dokumentu
Příklad
Následující fragment kódu načte " books.xml " do xmlDoc a zobrazí umístění dokumentu 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;
}
Výstup:
Document location: https://www.w3schools.com/xml/books.xml
Definice a použití
Vlastnost documentURI nastavuje nebo vrací umístění dokumentu.
Syntax
documentObject.documentURI
❮ Objekt dokumentu