Is any method in Java which can create the Doctype parameter in the XML document, that is to produce !DOCTYPE Response SYSTEM "MyResponse.dtd"> ?

Oliver Springauf

There is no such method in the DOM spec. However, the implementation you are using might provide one. In Sun's JAXP implementation, there is the method XmlDocument.setDoctype(String dtdPublicId, String dtdSystemId, String internalSubset) that you can use. Unfortunately, there is no official documentation on the implementation, and you are losing your independence from the implementation when you are calling these methods.