[jdom-interest] SAXOutputter

Laurent Bihanic laurent.bihanic at atosorigin.com
Mon Apr 19 05:42:52 PDT 2004

Bradley S. Huffman wrote:
>>This most frequently comes up in TrAX. Some processors call 
>>startDocument and endDocument for a fragment. Some don't. I don't 
>>think the spec properly addresses this point. :-(
> Yep, IIRC this came up last time Laurent was working on JDOMResult.  So any
> opinion on what JDOM should do?  From your first post, I assume your paper
> advocates only calling startDocument on the start of a actual well-formed
> document, but not when used to process a fragment.

Of all JAXP-compliant XSLT processors I tested, only Oracle's does not call 
start/endDocument when outputting fragments.

This kind of behaviour is quite difficult to handle in reusable 
ContentHandlers (how to detect a new document/fragment is being outputted ?). 
Moreover, many existing ContentHanlder classes expect start/endDocument calls, 
as specified by SAX, regardless being processed XML is a document or a fragment.

IMHO, as long as SAX does not specify how to deal with fragments, SAXOutputter 
should continue calling start/endDocument. Then, it is always possible to add 
hooks to override this default behaviour.


More information about the jdom-interest mailing list