[jdom-interest] Request for new methods removeText(), replaceText(), & replaceContent().

Jason Hunter jhunter at collab.net
Tue Mar 20 15:09:01 PST 2001

> I have attached a version of Element.java with three new methods:
>         public boolean removeText();

Your impl iterates through the mixed content and removes all String and
CDATA entries.  I'm not sure that's generally useful.

>         public void replaceText( String newText );

This does the above but then adds at the end the new text.  It's not
really a replacement then, because a<?pi?>b becomes <?pi?>newText.

For both of these, I think it better to use the List API to make

>         public void replaceContent( Element oldElement, Element newElement );

This one there may be a use for.  List doesn't have a replace() method. 
Too bad.  But you can simulate it easily enough, so I'm not sure it's
worth the API bloat.


More information about the jdom-interest mailing list