[jdom-interest] RE: SAXBuilder with regards to the textcontent

Joseph Bowbeer jozart at csi.com
Sun Dec 10 00:33:31 PST 2000

Concerning stripping whitespace from SAXBuilder:

There is a DataUnformatFilter in samples.sax, and some test code in

  /* Remove pretty formatting from formatted xml file. */
  builder = new SAXBuilder();
  builder.setXMLFilter( new DataUnformatFilter() );
  doc = builder.build(in);

The DataUnformatFilter was designed to remove the whitespace inserted by
the DataFormatFilter.  It removes newlines and indentation from elements
with mixed content, leaving either text or element content, but not

It's careful not to change the whitespace inside elements that do not
have mixed content, because for all it knows that whitespace is
significant.  In other words, it doesn't trim() the element content.

If trim()'d element content is a popular option, I agree that a
SAXBuilder option is warranted.  (XMLFilter's are not easy to write.)

----- original message -----
From: Kesav Kumar <kesavk at voquette.com>
Cc: jdom-interest at jdom.org
Subject: RE: [jdom-interest] SAXBuilder with regards to the textcontent
Date: Fri, 8 Dec 2000 17:49:23 -0800

I wrote this earlier.  I actually modified the SAXBuilder code locally
for my purpose.  I am very much intersted in having flag in Builder and
to get rid of the unnecessary blank strings which I guess saves some

Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:kesavk at voquette.com

More information about the jdom-interest mailing list