[jdom-interest] SAXBuilder enhancement request /2

Alex Rosen arosen at silverstream.com
Fri Mar 29 11:18:08 PST 2002


I've always wanted an option that would throw away all whitespace from
Elements that have child Elements, perhaps with an exception for
xml:space="preserve". This heuristic would ensure that data-centric XML
would never lose information. "Data-centric" means any XML without mixed
content, like J2EE deployment desciptors, Ant buildfiles, etc. It would, of
course, be off by default.

Alex

> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Elliotte
> Rusty Harold
> Sent: Friday, March 29, 2002 8:41 AM
> To: phil at triloggroup.com; jdom-interest at jdom.org
> Subject: Re: [jdom-interest] SAXBuilder enhancement request /2
>
>
> 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/    |
> +----------------------------------+---------------------------------+
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com




More information about the jdom-interest mailing list