[jdom-interest] Bug: JDOMResult drops trailing text

Roskowetz, Thorsten (empolis GT) Thorsten.Roskowetz at empolis.com
Wed Sep 24 06:37:51 PDT 2003


Hi,

I've found a bug in org.jdom.transform.JDOMResult (b9 and latest nightly
snapshot)
where - in case of a not well-formed result - trailing text is lost.

The reason: if the result of an XSLT transformation ends with text then
method
flushCharacters() of class SAXHandler is never called for the remaining
text.

Possible bugfix: Change method getResult() of private class FragmentHandler
(part of JDOMResult) to something like this:


    public List getResult() {
      try {
        this.flushCharacters();
      }
      catch (SAXException ex) {
	  // ignore
      }
      return (this.getDetachedContent(dummyRoot));
    }


This way, we make sure that remaining characters will be flushed and a Text
Object will be added to the dummyRoot node if necessary.


Cheers,
Thorsten



More information about the jdom-interest mailing list