[jdom-interest] SAXOutputter
Laurent Bihanic
laurent.bihanic at atosorigin.com
Tue Apr 20 08:57:14 PDT 2004
Bradley S. Huffman wrote:
> The biggest thing is if and when the SAX folks make a decision, if they
> choose to go with startDocument always being called before other events,
> even for fragments, then code using the current JDOM code and a wrapper
> doesn't break. If however people use output(List/Content, false) or the
> behaviour of SAXOutputter is changed so it doesn't call startDocument before
> fragments, code base on that behaviour has a good chance of breaking Plus
The point here is not whether startdocument should bbe called or not. We are
just adding a feature to SAXOutputter to output pieces of an XML document.
This new feature does not offer any guarantee that the resulting "document" is
well-formed. Actually, the only way to be sure to output a well-formed
document is to use output(Document).
I'll update the Javadoc for these methods saying that the user is responsible
for issuing the startDocument and endDocument calls to the ContentHandler
prior and after using one or several of these methods.
> I have a adversion to booleans in parameter lists, but that's me. Finally as
> you pointed out, all parsers except one, always call startDocument/endDocument,
> so JDOM's current behaviour is consistent.
OK, what about calling these methods outputFragment as Chris suggested ?
This naming scheme makes the intent of the methods clearer, helping not to mix
calls to output and outputFragment.
Laurent
More information about the jdom-interest
mailing list