XML DOM lookupNamespaceURI() Metode
Objek Simpul
Contoh
Fragmen kode berikut memuat " books_ns.xml " ke dalam xmlDoc dan menemukan URI namespace untuk awalan "c" yang diberikan:
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");
}
Keluaran:
https://www.w3schools.com/children/
Definisi dan Penggunaan
Metode lookupNameSpaceURI() mengembalikan URI namespace yang terkait dengan awalan yang diberikan.
Dukungan Peramban
Metode lookupNamespaceURI() didukung di semua browser utama.
Catatan: Internet Explorer 9 dan versi sebelumnya tidak mendukung metode ini.
Sintaksis
nodeObject.lookupNamespaceURI(prefix)
Parameter
Parameter | Type | Description |
---|---|---|
prefix | String | Required. Specifies the prefix to look for |
Nilai Kembali
Type | Description |
---|---|
String | The namespace URI associated with the specified prefix |
Detail Teknis
Versi DOM | Objek Node Tingkat 3 Inti |
---|
Objek Simpul