[jdom-interest] Moving Subtrees using JDOM

Jason Hunter jhunter at acm.org
Sat Feb 23 00:53:16 PST 2002

Rocker Bill wrote:
> Hi,
> Without getting myself too lost, I am trying to move a sequence of elements
> with associated content from one top level parent to another, within the
> same document... such as...
> <root>
> <ele1>
>    <ele2>
>       <ele3/>
>    </ele2>
> </ele1>
> <ele4>
> </ele4>
> </root>
> In the above case, I want to move the subtree containing ele2 and ele3 from
> the parent, ele1, to beneath the new parent ele4 (ele2 and ele3 will also
> have associated content).


That should be all you need.  ele2 will take his children.  We're
talking about if you want to move ele1 and ele4 (siblings) to a
different root that you have to do it iteratively.


More information about the jdom-interest mailing list