XML DOM name attribute

Definition and Usage

name The attribute returns the name of the DTD (the name following the DOCTYPE keyword).

Syntax

documentObject.doctype.name

Example

The following code loads "note_internal_dtd.xml" into xmlDoc and displays the name of the 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;
{}

Try It Yourself