[jdom-interest] Element.getContentTrim() ?

Alex Rosen arosen at silverstream.com
Mon Oct 8 09:08:12 PDT 2001


> Then why is getTextTrim() there? What I'm asking for is not
> particularly
> different from that...

I don't think getTextTrim() should be there either - see
http://www.servlets.com/archive/servlet/ReadMsg?msgId=148238&listName=jdom-i
nterest. I do think that your proposal is significantly different from
getTextTrim(), though, because it recurses into child nodes. This is another
"stylized" usage of XML - the only time you'd want to do this is for
HTML-like uses of XML, and there are lots of other ways to use XML than
that. I'm not wild about adding special support to the core JDOM classes to
support all the different XML styles that are possible. However, adding
something like this to a helper class would be OK with me - like:

String val = Helper.getRecursiveText(element);
String val = Helper.getRecursiveTextNormalize(element);

...except with better names, hopefully. And with the warning that there are
HTML-type constructs that this will not work for, as I referenced in my last
post.

Alex







More information about the jdom-interest mailing list