XML DOM lookupNamespaceURI() Metode
❮ Node Voorwerp
Voorbeeld
Die volgende kodefragment laai " books_ns.xml " in xmlDoc en vind die naamruimte-URI vir die gegewe "c"-voorvoegsel:
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");
}
Uitset:
https://www.w3schools.com/children/
Definisie en gebruik
Die lookupNameSpaceURI() metode gee die naamruimte URI terug wat met 'n gegewe voorvoegsel geassosieer word.
Blaaierondersteuning
Die lookupNamespaceURI() metode word in alle groot blaaiers ondersteun.
Let wel: Internet Explorer 9 en vroeër ondersteun nie hierdie metode nie.
Sintaksis
nodeObject.lookupNamespaceURI(prefix)
Grense
Parameter | Type | Description |
---|---|---|
prefix | String | Required. Specifies the prefix to look for |
Terugkeerwaarde
Type | Description |
---|---|
String | The namespace URI associated with the specified prefix |
Tegniese besonderhede
DOM weergawe | Kernvlak 3 Node-objek |
---|
❮ Node Voorwerp