Nazwa XML DOM Właściwość
❮ Obiekt typu dokumentu
Przykład
Poniższy fragment kodu ładuje plik „ note_internal_dtd.xml ” do xmlDoc i wyświetla nazwę DTD:
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "note_internal_dtd.xml", true);
xhttp.send();
function myFunction(xml) {
var xmlDoc = xml.responseXML;
document.getElementById("demo").innerHTML =
xmlDoc.doctype.name;
}
Wyjście:
note
Definicja i użycie
Właściwość name zwraca nazwę DTD (nazwę występującą bezpośrednio po słowie kluczowym DOCTYPE).
Składnia
documentObject.doctype.name
❮ Obiekt typu dokumentu