XML DOM » DocumentType » name

Compability: Internet Explorer

Syntax:
documentType.name

This property contains the name of the document type; i.e., the name that immediately follows the 'DOCTYPE' keyword.

In this example we use the 'staff.xml' file which has the following DOCTYPE declaration: !DOCTYPE staff SYSTEM "staff.dtd" The code then returns the name property of the DocumentType.

Examples

Code:
xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("staff.xml");

d_type = xml_doc.doctype;
document.write(d_type.name);
Output:
staff
Explanation:

In this example we use the 'staff.xml' file which has the following DOCTYPE declaration: <!DOCTYPE staff SYSTEM "staff.dtd"> The code then returns the name property of the DocumentType.

Language(s): JavaScript