[jdom-interest] Bug in SAXBuilder for mixed content

Michael Hinchey michael.hinchey at inference.com
Fri Jun 9 21:18:47 PDT 2000


Okay, so I can partly fix it.

SAXHandler.endElement() in SAXBuilder.java:
  public void endElement(String namespaceURI, String localName,
                         String rawName) {
    if (needsRTrim) {
      Element e = (Element) stack.peek();

      /////e.setContent(rtrim(e.getContent()));
    }
    ...
  }

I suppose blindly commenting out other people's code is not the right way to
do a bug fix, but it works for my test cases.  Hopefully, though, it will
help.

My guess is that SAXBuilder should not be trimming content, but Element
should do it.

-Mike


-----Original Message-----
From: Michael Hinchey [mailto:michael.hinchey at inference.com]
Sent: Friday, June 09, 2000 8:00 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Bug in SAXBuilder for mixed content


Of the four documents (below), I think the first two have correct output,
but 3 and 4 do not.  I would gues the problem is in SAXBuilder, which counts
me out for offering a quick fix, as I know nothing about SAX.  Calling
getChild("c") on the elements throws a NoSuchElementException for documents
3 and 4.  (I'm using the June5 source.)

<snip/>



More information about the jdom-interest mailing list