XML DOM doctype attribute
Definition and usage
The doctype attribute 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
Instance
In all examples, we will use the XML file note_internal_dtd.xml, as well as 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]