2013-04-25 77 views
0

我想要的DOCTYPE聲明添加到輸出XML文件的Xerces 2.8如何獲得使用DOM DOCTYPE聲明上使用的Xerces 2.8

我使用的DOMDocument * DOC1 = implementation-> createDocument();創建文檔

我想將doctype從doc添加到doc1。

我可以從文檔獲得文檔類型如下:

DOMDocumentType * DOCUMENT_TYPE = doc-> getDoctype();

但是,我無法將document_type傳遞給函數createDocument()。

有沒有人有如何做到這一點的例子?

謝謝

吉爾默

回答

0

你有你的Xerces實例的「http://xml.org/sax/properties/lexical-handler」屬性設置爲類型的對象「LexicalHandler」。您將被通知有關「startDTD」回調的任何事件。這對於Java來說至少是正確的。 C應該相同。