XML DOM documentURI - eigenschap
❮ Documentobject
Voorbeeld
Het volgende codefragment laadt " books.xml " in xmlDoc en geeft de locatie van het XML-document weer:
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;
}
Uitgang:
Document location: https://www.w3schools.com/xml/books.xml
Definitie en gebruik
Met de eigenschap documentURI wordt de locatie van het document ingesteld of geretourneerd.
Syntaxis
documentObject.documentURI
❮ Documentobject