[jdom-interest] Exception while sorting

d.breitenmoser at bluewin.ch d.breitenmoser at bluewin.ch
Tue Aug 19 07:56:26 PDT 2003

Hi all

I try to sort a list of elements, but it occurs the following an exception.

Exception in thread "main" org.jdom.IllegalAddException: The element already
has an existing parent "catalog"

Element root = data.getRootElement();
List elements = root.getChildren();
Collections.sort(elements, new MyComparator(name));

Does anybody know why this error occurs ?

Cheers David

More information about the jdom-interest mailing list