XML DOM doctype property

Document Object Reference Manual

Definition and Usage

The doctype property can return the document type declaration (Document Type Declaration) associated with the document.

For XML documents without DTD, it returns null.

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

Syntax:

documentObject.doctype

Example

In all examples, we will use the XML file note_internal_dtd.xml, and the JavaScript function loadXMLDoc().

The following code snippet can return a DocumentType object:

xmlDoc=loadXMLDoc("note_internal_dtd.xml");
document.write(xmlDoc.doctype);

Output:

[object DocumentType]

Document Object Reference Manual