doctype 屬性返回與文檔相關(guān)的文檔類型聲明(DTD,全稱 Document Type Declaration)。
對(duì)于沒(méi)有 DTD 的 XML 文檔,則返回 null。
該屬性提供對(duì) DocumentType 對(duì)象(Document 的一個(gè)子節(jié)點(diǎn))的直接訪問(wèn)。
下面的代碼片段使用 loadXMLDoc() 把 "note_internal_dtd.xml" 載入 xmlDoc 中,并返回 DocumentType 對(duì)象:
輸出:
更多建議: