[jdom-interest] JDOMResult Reuse
laurent.bihanic at atosorigin.com
Thu Oct 24 06:55:44 PDT 2002
Elliotte Rusty Harold wrote:
> The recent changes to JDOMRsult to support List output are important in
> bringing JDOM into compliance with XSLT. We can now handle a lot fo
> stylesheets that couldn't be handled before. Thanks Laurent!
> However, as is often the case, fixing one issue reveals another. Looking
> at the code it's not clear to me what happens (or what should happen) if
> the same JDOMResult object is used for the output of multiple
> transformations in series. I don't see anywhere that the result gets
> reset to begin anew with a new list. I think the new nodes would just
> get appeneded to the list of old nodes, which is probably not what we want.
The current result is reset as soon as a new transformation starts (call to
setResult(null) in the implementation of startDocument() of DocumentBuilder
> Assuming I'm not missing something, I think maybe JDOMResult needs
> either a reset method, or some documentation about not reusing the
> object for multiple transformations, or both. Ideally I'd like to handle
> this automatically (i.e. as soon as a tranformation starts, reset the
> list of nodes it's building to an empty list) but I'm not sure I can
> find a good place to hook that in. I considered resetting the list in
> startDocument() in the handler, but that doesn't really work because
> startDocument() may not be called if we don't have a complete
I assumed startDocument is always called as defined by the ContentHandler
contract. So far it seems the XSLT processors I tried follow this assumption.
Have found a test case that makes this wrong?
More information about the jdom-interest