[jdom-interest] Bug in SAXHandler: ignorable white space is thrown away

Jason Hunter jhunter at collab.net
Wed May 2 02:14:01 PDT 2001


philip.nelson at omniresources.com wrote:
> 
> > Cool, thanks.  At least someone was coding while I was emailing.  :-)
> >
> > Elliotte, please verify all is OK.
> 
> Do we need a way to turn this off?

Yes, there should be a way to turn it off.  There are some statements in
the TODO about providing different flags for different whitespace
handling behaviors.  I'd recommend adding the following:

setIgnoringElementContentWhitespace(boolean) 
  This is a method added to JAXP 1.1.  It'd make sense for us to support
  it, probably using their name.  It tells the parser to ignore the
  ignorable.  Easy to implement.

setIgnoringAllWhitespace(boolean)
  This would be more aggressive, useful for those who don't care about
  whitespace (reading web.xml for example) and want to save memory and
  probably build time.  I'm not yet sure of its exact behavior.  I'm 
  torn between going out of our way to remove whitespace versus a 
  simpler approach that just, for example, trims the String constructed 
  by the characters() callback.

There perhaps should be isXXX() methods added as well.

-jh-





More information about the jdom-interest mailing list