[jdom-interest] Doctype entity declaration

philip.nelson at omniresources.com philip.nelson at omniresources.com
Thu Mar 22 19:48:40 PST 2001

> I have been working on support for Internal and External 
> Entity declarations
> within a DocType declaration.


> While this is mostly done, I am struggling with how to handle 
> the output of
> these declarations with XMLOutputter.
> Should I call DocType.getSerializedForm(), and allow this to 
> write out the
> "children" declarations, or handle this explicitly in XMLOutputter?

If you mean, should DocType take a PrintWriter or OutputStream and write to
it I would say that isn't what the classes in org.jdom do IMHO.  So I would
say explicitly in the outputters makes sense.  If the api you created for
walking the DocType doesn't make it easy, then that could be improved
because that's exactly how others would end up using the class for other

> Right now, XMLOutputter.printDocType(...) and 
> DocType.getSerializedForm()
> are basically duplicating the same code.  Which is the 
> preferred method of
> outputting a DocType?  Should both methods be modified, or 
> should this be
> standardized to one form or the other?  Any ideas?

There is a mention about getSerializedForm in the todo.  I don't think it
will survive the final cut because of issues of how deep to go and why do it
when we can use outputters to do the same thing.  But then there's no
theOutputter(DocType doc) either so ...?

> (I realize that SAXOutputter and DOMOutputter will also 
> require some changes
> to handle EntityDeclarations, but I started with XMLOutputter 
> because it is
> easier conceptually.)

Yes, makes sense to me.

More information about the jdom-interest mailing list