FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

XML DOM doctype Property


Document Object Reference Document Object

Example

The following code fragment loads "note_internal_dtd.xml" into xmlDoc and returns a DocumentType object:

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
   if (xhttp.readyState == 4 && xhttp.status == 200) {
       myFunction(xhttp);
   }
};
xhttp.open("GET", "note_internal_dtd.xml", true);
xhttp.send();

function myFunction(xml) {
    var xmlDoc = xml.responseXML;
    document.getElementById("demo").innerHTML =
    xmlDoc.doctype;
}

Output:

[object DocumentType]
Try it Yourself »

Definition and Usage

The doctype property returns the Document Type Declaration associated with the document.

For XML documents without a DTD this returns null.

This provides direct access to the DocumentType object (a child node of this Document).

Syntax

documentObject.doctype

Document Object Reference Document Object