[jdom-interest] setExpandEntities and XMLOutputter behaviour

Manish Sharan manish.sharan at divlogic.com
Thu May 6 10:56:30 PDT 2004

Ok so this is how I solved it :
  document.getDocType().setInternalSubset(null) ;

This preserves  the original xhtml doctype declaration and cleans out the

Even though this is working for me , I can see that the issue remains :
shouldnt  document.getDocType().getIternalSubset() return only the
internal DTD ?  It seems that when setExpandEntities(false) is set,
somehow the external DTDs also end up in internal subset which means the
when you output using XMLOutputter, all the content from the external DTDs
get included in the output

Is this a bug or a expected behaviour ?


> 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
> browser/reneder.
> Regards
> manish
>> 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
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list