Propriedade XML DOM documentURI
❮ Objeto Documento
Exemplo
O fragmento de código a seguir carrega " books.xml " em xmlDoc e exibe o local do documento 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;
}
Saída:
Document location: https://www.w3schools.com/xml/books.xml
Definição e uso
A propriedade documentURI define ou retorna o local do documento.
Sintaxe
documentObject.documentURI
❮ Objeto Documento