[jdom-interest] SAXBuilder enhancement request /2

Alex Rosen arosen at silverstream.com
Mon Apr 1 07:40:41 PST 2002

> Alex wrote:
> >>>I've always wanted an option that would throw away all
> whitespace from Elements that have child Elements<<<
> It is not only for Elements that have children, because you
> may have cases liken
>     <MyElementList>
>     </MyElementList>
> Which is an empty list and should not contain any Text node.

But how do you know that? Maybe whitespace is significant in this case. For

  <IndentString>    </IndentString>


    <Password>   </Password>

My proposal will not lose data for ANY data-oriented (i.e.
non-mixed-content) XML file. Your proposal would not lose data for 99.9% of
these XML files, but that .1% is a killer. Especially since sometimes (e.g.
in the second example above), it'll work fine until you hit an edge case, so
QA may not find the problem. Not that this second example is a good idea,
but you get the picture.

It's true that my proposal will leave unnecessary whitespace in certain
cases, like empty lists, but that shouldn't really cause an actual problem,
should it?


More information about the jdom-interest mailing list