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

Brett McLaughlin brett at newInstance.com
Tue Jul 17 17:36:47 PDT 2001

> But in the data oriented case it doesn't recurse!!!! It does exactly what
it's doing now. Making it recurse in the case where there is mixed content
will cause no problems or issues for the case where there isn't.

OK. It seems that nobody is overly happy with things... and I'm really not
that happy with the status quo. However, I'm equally uneasy with changing
the existing behavior of getText(); it's obvious that nobody agrees on the
meaning, and while the "check the docs" argument is compelling, it's not
realistic. As an author of Java books, trust me on this! ;-)

The things that come to mind are methods more along the lines like:

getChildText() - gets the direct text (what getText() does now)
getTextValue() or getRecursiveText() or something (the recursive way)

Of course, now we're once again making a change that requires HUGE changes
in code.

So maybe it's better put this way - I don't see that changing getText() to
be recursive, and no other changes, is a good thing, because it's clear to
some and not others (in other words, it's really not any better than now,
but it is a change - not good). So, we either stick with the API now,
possibly adding a recursive method with a new name, or we remove getText()
completely and add new, more descriptive method names.

BTW, I know Jason will be pissed if we remove getText() altogether, so get
ready to argue hard if that's your opinion ;-)

Brett McLaughlin
Enhydra Strategist:   http://www.enhydra.org
Lutris Technologies: http://www.lutris.com
O'Reilly Author:       http://www.newInstance.com

More information about the jdom-interest mailing list