[jdom-interest] Element.getContentTrim() ?

Alexander Hvostov root at aoi.dyndns.org
Mon Oct 8 09:37:12 PDT 2001


On Mon, 8 Oct 2001 12:08:12 -0400, "Alex Rosen" <arosen at silverstream.com> wrote:

> > 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

That's NOT what I was asking for. I was asking for, quite simply, all text
content _directly_ contained in an Element to get trimmed. This does not mean
recursing into its child Elements.

Regards,

Alex.



More information about the jdom-interest mailing list