How to retain DOCTYPE declaration while saving DOM Document to an XML file

18,867 views
By Abhijit Ghosh on Sep 13, 2012 2:13:01 PM

If we save a DOM Document to an XML file using javax.xml.transform.Transformer, DOCTYPE declaration gets emitted by default. This example shows how we can retain PUBLIC and SYSTEM id of the DOCTYPE declaration for external DTD.

Tags:

About this 'Hello World' site

This site is mainly developed to share coding and technology learning experiences on java / j2ee based technologies.

Simple tutorials / codes have been shared to learn a new technology. Full source code is also available for download.