DocumentType.name
The name property contains the name of the document type; i.e., the name that
immediately follows the 'DOCTYPE' keyword.
In the 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.
Code (JavaScript):
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
|