[jdom-interest] setExpandEntities and XMLOutputter behaviour

Manish Sharan manish.sharan at divlogic.com
Thu May 6 07:01:02 PDT 2004

If I setDocType(null) before xmloutputter is invoked, it does not output
the doctype at all -- but since this is a xhtml document, I need the
doctype do be preserved.

Is there to override the Xmloutputter.output(DocType doctype,
java.io.OutputStream out)  behaviour so  that it does not write out the
external DTDs inside the Doctype declarartion?

Btw, I am setting saxBuilder.setExpandEntities(false) so that I preserve
the entities in the xhtml document leaving this task to the


> Manish Sharan wrote:
>> When I set saxBuilder.setExpandEntities(false)  and  output the docment
>> using XMLOutputter, the XMLOutputter includes all the external DTDs
>> within the Doctype declaration. This does not happen when
>> setExpandEntities(true) is used.
>> I am aware that an XML parser will by default load the external DTD
>> files
>> but Is there a way to ensure that the XMLOutputter does not include them
>> (the external DTDs)in its output.
> Can't you remove the DocType object from the Document before outputting
> it,
> using Document.setDocType(null) ?
> Laurent

More information about the jdom-interest mailing list