[jdom-interest] Problem with 'setChildren' on JDOM B8

duncan.loveday at bt.com duncan.loveday at bt.com
Fri Dec 6 05:00:02 PST 2002

Has anyone come across a problem with 'setChildren()' not clearing textual
content on JDOM B8 ?

In our application we needed a way of preserving Element content whilst
clearing textual content. We used the following line of code :-


on JDOM B7 and it worked. According to the java docs, setChildren() should
clear existing Element and non-Element content.

However, on JDOM B8 it appears to leave the text content as is. In my test,
the element has only a single item of text content and no Element content,
so I'm actually passing an empty list to element.setChildren(). After the
call I still have the one text content item there.

Is this a bug for a feature ?

More information about the jdom-interest mailing list