[jdom-interest] SAXBuilder enhancement request /2

Elliotte Rusty Harold elharo at metalab.unc.edu
Fri Mar 29 05:40:49 PST 2002

At 8:41 AM +0100 3/29/02, phil at triloggroup.com wrote:
>After looking at DOM4J, it appears that these guys added this 
>capability recently ("stripWhitespaceText"). This is
>effectively very convenient when dealing with data centric document.
>Can we add it to JDOM?

This makes me very nervous. It's a common misconception that white 
space is insignificant in XML. It's not.

As long as the default is to keep all space, and throwing it away 
requires an explicit client choice, I can live with this, but please 
put big warnings about it in the JavaDoc.

And you'd have to define very carefully what space is kept and what 
is not and document your choice. For instance, do you want to throw 
away all white space? All white-space only text nodes? All ignorable 
white space? These are three different things.

Another thought: maybe what's needed is a more generic builder filter 
operation that could do this and a lot more? SAX filters could 
certainly handle it.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |

More information about the jdom-interest mailing list