[jdom-interest] Sorting JDOM lists

Chris B. chris at tech.com.au
Sun Mar 7 18:31:58 PST 2004

Is there any reason why JDOM won't allow you to sort a list of Elements??

Element el...
java.util.List items = (java.util.List)el.getChildren("aaaa", ns);
Collections.sort(headeritems, new Comparator() {

org.jdom.IllegalAddException: The element already has an existing parent 
    at org.jdom.ContentList.add(ContentList.java:177)
    at org.jdom.ContentList.add(ContentList.java:138)
    at org.jdom.ContentList.set(ContentList.java:679)
    at org.jdom.ContentList$FilterListIterator.set(ContentList.java:1142)
    at java.util.Collections.sort(Collections.java:159)

More information about the jdom-interest mailing list