Propriedade baseURI do XML DOM
Definição e Uso
baseURI
Atributo que retorna a URI base absoluta do nó.
Sintaxe
nodeObject.baseURI
Detalhes Técnicos
Retorno: | String que representa a URI base absoluta do nó. |
---|---|
Versão do DOM: | Objeto de Nó de Nível de Núcleo 3 |
Exemplo
A seguir, o código carregará "books_ns.xml" para xmlDoc e retornará a URI base do elemento <title>:
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { myFunction(this); } }; xhttp.open("GET", "books_ns.xml", true); xhttp.send(); function myFunction(xml) { var x, i, xmlDoc, txt; xmlDoc = xml.responseXML; txt = ""; x = xmlDoc.getElementsByTagName("title"); for (i = 0; i < x.length; i++) { txt += "Base URI: " + x.item(i).baseURI + "<br>"; } document.getElementById("demo").innerHTML = txt; }
Suporte de Navegador
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Suporte | Suporte | Suporte | Suporte | Suporte |
Todos os navegadores principais suportam baseURI
Atributos, exceto no Internet Explorer.