XML DOM namespaceURI Proprietà
❮ Oggetto Elemento
Esempio
Il seguente frammento di codice carica " books_ns.xml " in xmlDoc e ottiene l'URI dello spazio dei nomi dal primo 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 xmlDoc = xml.responseXML;
var x =
xmlDoc.getElementsByTagName("c:title")[0];
document.getElementById("demo").innerHTML =
x.namespaceURI;
}
L'output del codice sopra sarà:
https://www.w3schools.com/children/
Definizione e utilizzo
La proprietà namespaceURI restituisce l'URI dello spazio dei nomi per l'elemento selezionato
Se il nodo selezionato non è un elemento o un attributo, questa proprietà restituisce sempre NULL.
Sintassi
elementNode.namespaceURI
❮ Oggetto Elemento