[jdom-interest] no getChildTextNormalize() ?

Alex Rosen arosen at silverstream.com
Wed Sep 26 08:50:30 PDT 2001

> the get*Trim methods are a god send if, like me, you are handling hand
> written XML.

... until you run into a situation where extra whitespace is meaningful, in
which case these methods will lose important data.

I'm always conflicted about convenience methods. They're so nice when you
use them, but if you don't use them, they just clutter up the interface.
I've always been thinking that all the getChildText() and the trimming and
normalizing methods belong in helper classes, since they're only appropriate
for one style of XML documents. Like:

  String val = JDOMHelper.getChildTextNormalize(element, "childname");

instead of:

  String val = element.getChildTextNormalize("childname");

It's slightly less convenient for those that want to use it, but I think
more appropriate for a generic XML handling library like JDOM.

> I estimate using JDOM rather than DOM has saved me at least 3 months work.
> JDOM must be the Java programmers XML API of choice.



More information about the jdom-interest mailing list