[jdom-interest] getChildTextNormalize()

Kent C. Johnson kentyman23 at hotmail.com
Mon Oct 1 17:19:47 PDT 2001

So I guess the stuff I wrote isn't needed. ;)  Oh well, here's what I 


Anyway, I like the idea but there are a few things I wanted to comment on.  
Note that they are somewhat mirroring what I said in my previous post which 
you can read here:


My big problem with it is consistancy (a theme in a lot of my rants :) ).  
What do you think about the idea of having Element have getText() and 
getChildText(), and from there letting the helper class do the formatting?  
This would mean maybe a trimText() and a normalizeText() method of the 
helper class.  Granted trimText() will probably be implemented as just 
String.trim(), but I think it is good procedure to keep it there for 
consistancy.  This can be omitted, not a huge deal, just a thought.

Now, if the above way was implemented, there would really only be 2 helper 
methods... hardly worth an entire class.  Perhaps these could all be 
combined into one big helper class (I used the name JDOMHelper, which I 
believe I stole from you, Alex).  Laurent Bihanic mentioned another helper 
method he wanted in the following post:


...which could be included as well.

Any thoughts?

Best regards,

>From: "Alex Rosen" <arosen at silverstream.com>
>To: <jdom-interest at jdom.org>
>Subject: RE: [jdom-interest] getChildTextNormalize()
>Date: Mon, 1 Oct 2001 19:37:06 -0400
>So, I've dusted off the helper I was writing a while ago and checked it in
>to jdom-contrib.
>This can replace all of the trim, normalize, and getChildText methods in
>Element. They become:
>String val = element.getText().trim();
>String val = TextHelper.normalize(element.getText());
>String val = TextHelper.getChildText(element, "childname");
>String val = TextHelper.getChildTextTrim(element, "childname");
>String val = TextHelper.getChildTextNormalize(element, "childname");
>(Note that getText() will never return null, but getChild() might, hence 
>need for the last 3 methods.)
>This is intended to be a starting point. I'm happy to take opinions as to
>the name of the class, which Element methods we should remove or keep, or
>whether this is a good idea at all.
>To control your jdom-interest membership:

Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

More information about the jdom-interest mailing list