[jdom-interest] setText() to replace children?

Tom Bradford bradford at dbxmlgroup.com
Tue Jul 10 14:33:58 PDT 2001

Jon Baer wrote:
> There are some people who actually *NEED* that type of function and rely
> on JDOM for it, technically NOT is not part of the "text" of <p> I
> strongly beleive that if you need to recurse through it for text you
> need another utility function like getPlainText(), etc.
> And I think if people lay down anything like
> setText("<a>me<b>you</b></a>") that they are just being lazy.

What's wrong with being lazy?  It's one of the strongests catalysts for
human innovation.  I'm proud to be lazy.

On the subject of text storage and retrieval with a single method where
mixed content is being stored, how the text stream is extracted is very
application dependent.  Technically "not" isn't part of the text as far
as the object model is concerned, but it may well be where the
application is concerned.  Especially document-centric applications, but
even data-oriented apps.  

My proposed solution would be to stick with a system like the DOM
traversal mechanism for retrieval.  That way you have more control over
the data that you're retrieving.  Also, I don't think there should be a
getText/setText method at all for elements.  It goes against the
granular control patterns that are everywhere else in JDOM, and will
only lead to confusion and data loss.

-- Tom

More information about the jdom-interest mailing list