Proprietà doctype del DOM XML
Definizione e uso
doctype
La proprietà restituisce la dichiarazione di tipo di documento associata al documento.
Per i documenti XML senza DTD, questa proprietà restituisce null.
Questo fornisce l'accesso diretto all'oggetto DocumentType.
Sintassi
documentObject.doctype
Esempio
Il codice seguente carica "note_internal_dtd.xml" nel xmlDoc e restituisce l'oggetto DocumentType:
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; {}