[jdom-interest] Problems by sorting the list (JDOM beginner)
Galuc
galuc at ebruit.com
Wed Mar 27 14:48:25 PST 2002
Hi!
Thanks for trying helping me.
I tried it, but it didn't work.
It makes an exception:
java.util.ConcurrentModificationException
Galuc
----- Original Message -----
From: "Julien GROUTEAU" <sabela_julien_grouteau at yahoo.fr>
To: "Galuc" <galuc at ebruit.com>
Sent: Wednesday, March 27, 2002 11:29 PM
Subject: RE: [jdom-interest] Problems by sorting the list (JDOM beginner)
> One thing I found useful, while sorting list of childrens, is to detach
them
> prior to any 'processing' on them.
>
> So I would say :
>
> List ch = root.getChildren;
> Iterator it = ch.iterator ();
> while (it.hasNext ()) {
> Element element = (Element) it.next ();
> element.detach ();
> }
> Collections.sort (ch , mycomp);
>
> Hope this helps.
>
> Julien
>
>
> -----Message d'origine-----
> De : jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]De la part de Galuc
> Envoyé : mercredi 27 mars 2002 23:05
> À : jdom-interest at jdom.org
> Objet : [jdom-interest] Problems by sorting the list (JDOM beginner)
>
>
>
> Hi!
>
> My problem is, I can't sort the List!
> I use:
> List ch = root.getChildren;
> Collections.sort( ch , mycomp );
>
> I wrote a comparator, what works.
> But I got an exception:
> org.jdom.IllegalAddException: The element already has an existing parent
> "root"
>
> I tried to search in the archive, but I couldn't find any solutions!
>
>
> Thanks, Galuc
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
> t.com
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
More information about the jdom-interest
mailing list