[jdom-interest] SAXOutputter

Bradley S. Huffman hip at cs.okstate.edu
Thu Apr 15 12:08:32 PDT 2004


"Chris B." writes:

> Although I must say that it seems pretty normal for functions taking 
> Document to behave differently to functions taking Element. For example, 
> the XMLOutputter if I am not mistaken, will write the <?xml header if 
> given a Document, but won't if given an Element. I suspect this makes 
> perfect sense, as it does to assume startDocument for a Document, but 
> not assume it for Element.

And JDOMResult (a subclass of SAXResult) always calls startDocument whether
it's a well-formed document or a fragment, so SAXOutputter always calling
startDocument keeps things consistent (both output fragments as SAX events).

But Elliotte is right, this is a area were SAX is underspecified. If you
can get the SAX folks to decide one way or the other on this issue then
JDOM should comply.  Which I see from the mail archives Elliotte asked 4
different lists about in 2002, including the SAX developers list.

Brad



More information about the jdom-interest mailing list