The content() method returns a backed List implementation so that you can
use the java.util.List API to move items around to change order.

e.g.

Element bbb = (Element) document.selectSingleNode( "/AAA/BBB[@id='1']" );
List cccList = bbb.content();

// move the 3rd item to the head of the list
cccList.add(0, cccList.remove(2));

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: Stefanos Kaklamanis
To: [EMAIL PROTECTED]
Sent: Monday, November 25, 2002 7:57 AM
Subject: [dom4j-user] UP & DOWN an element


Hi all,

I need to manipulate some elements into an XML like this:

<AAA>
    <BBB id='1' bb='a'>
        <CCC id=1 c=1 ...>
        <CCC id=2 c=5 ...>
        <CCC id=4 c=13 ...>
        <CCC id=16 c=11 ...>
    </BBB>
    <BBB id='2' bb='e'>
        <CCC id=3 c=9 ...>
        <CCC id=5 c=8 ...>
        <CCC id=7 c=17 ...>
        <CCC id=11 c=2 ...>
    </BBB>
</AAA>

Usually CCC elements are sorted by id.
How can I move an CCC element one position UP or DOWN? Any ideas? What about
BBB elements?

Thanx,
Stefan

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to