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

Jason Hunter jhunter at acm.org
Wed Jul 11 17:53:10 PDT 2001

Brett McLaughlin wrote:
> One item in the TODO file:
> * Consider if setText() should not replace children

After reading the long discussion, I think we should keep the status
quo.  Let setText() do a simple content replacement.  It's the most
straightforward and the most predictable, and got the most support from

I don't like the idea of throwing an exception, for the reasons several
others stated.

I don't like getText() recursing either because in the data-oriented
view of XML for which JDOM is optimized, it doesn't make much sense to
recurse.  I'm happy to have the functionality available somehow, but not
as the getText() default behavior.

I do think we should take Alex Chaffee's suggestion tho and point out
the XMLOutputter.outputElementContent() method in Element.getText()'s

So Brett, if you're ok with that let's cross this off our TODO list and
integrate Alex's suggestion.


More information about the jdom-interest mailing list