XML DOM aramasıPrefix() Yöntemi
❮ Düğüm Nesnesi
Örnek
Aşağıdaki kod parçası, " books_ns.xml " dosyasını xmlDoc'a yükler ve verilen ad alanı URI'sinin önekini bulur:
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.lookupPrefix("https://www.w3schools.com/children/");
}
Çıktı:
c
Tanım ve Kullanım
lookupPrefix() yöntemi, belirli bir ad alanı URI'si ile ilişkili öneki döndürür.
Tarayıcı Desteği
lookupPrefix() yöntemi, tüm büyük tarayıcılarda desteklenir.
Not: Internet Explorer 9 ve önceki sürümleri bu yöntemi desteklemez.
Sözdizimi
nodeObject.lookupPrefix(namespaceURI)
parametreler
Parameter | Type | Description |
---|---|---|
namespaceURI | String | Required. Specifies the namespace URI to look for |
Geri dönüş değeri
Type | Description |
---|---|
String | The prefix associated with the specified namespace URI |
Teknik detaylar
DOM Sürümü | Çekirdek Düzey 3 Düğüm Nesnesi |
---|
❮ Düğüm Nesnesi