XML DOM doctype 屬性

定義和用法
doctype 屬性返回與文檔相關的文檔類型聲明(DTD,全稱 Document Type Declaration)。
對於沒有 DTD 的 XML 文檔,則返回 null。
該屬性提供對 DocumentType 對象(Document 的一個子節點)的直接訪問。
語法
documentObject.doctype
實例
下麵的代碼片段使用 loadXMLDoc() 把 "note_internal_dtd.xml" 載入 xmlDoc 中,並返回 DocumentType 對象:
實例
xmlDoc=loadXMLDoc("note_internal_dtd.xml");
document.write(xmlDoc.doctype);
document.write(xmlDoc.doctype);
輸出:
[object DocumentType]
