XML DOM lookupNamespaceURI() Metodo
❮ Oggetto nodo
Esempio
Il seguente frammento di codice carica " book_ns.xml " in xmlDoc e trova l'URI dello spazio dei nomi per il prefisso "c" specificato:
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("book")[0];
document.getElementById("demo").innerHTML =
x.lookupNamespaceURI("c");
}
Produzione:
https://www.w3schools.com/children/
Definizione e utilizzo
Il metodo lookupNameSpaceURI() restituisce l'URI dello spazio dei nomi associato a un determinato prefisso.
Supporto del browser
Il metodo lookupNamespaceURI() è supportato in tutti i principali browser.
Nota: Internet Explorer 9 e versioni precedenti non supportano questo metodo.
Sintassi
nodeObject.lookupNamespaceURI(prefix)
Parametri
Parameter | Type | Description |
---|---|---|
prefix | String | Required. Specifies the prefix to look for |
Valore di ritorno
Type | Description |
---|---|
String | The namespace URI associated with the specified prefix |
Dettagli tecnici
Versione DOM | Oggetto nodo di livello 3 di base |
---|
❮ Oggetto nodo