[jdom-interest] How can I copy XML pieces(3-4 levels) to another XML file??

Terje Kvambe Terje.Kvambe at multimedialab.tv
Fri Sep 28 05:58:50 PDT 2001

I'm not one of the real JDOM experts, but I would say that the answer to
your question is yes. You can use the clone method to take a deep copy of an
element. See javadoc from jdom.org below. If you want to cut&paste the
element, you can use the detach method instead.

public Object clone()
This returns a deep clone of this element. The new element is detached from
its parent, and getParent() on the clone will return null. 
clone in class Object
the clone of this element

public Element detach()
This detaches the element from its parent, or does nothing if the element
has no parent. 
Element - this Element modified.

Best regards,
Terje Kvambe

-----Original Message-----
From: Pedro Palomo [mailto:ppalomo at hotpop.com]
Sent: 28. september 2001 12:08
To: jdom-interest at jdom.org
Subject: [jdom-interest] How can I copy XML pieces(3-4 levels) to another
XML file??

Good morning Friendst¡¡¡ (In Spain)

I read some articles About JDOM to create,mutate and read XML files, but i
have a doubt.

    I'm developing an application that copy XML pieces(3-4 levels) to
another XML file, but i don't Know if JDOM have a function to copy( deep
copy?? Can i use the clone function??) a big piece of XML to another XML
file or I have to copy Element by Element and level by level??

    I wait for your expert tip¡¡¡¡¡

    My best regard from Mᬡga(Spain)

    Pedro Palomo Pozo.
    ppalomo at hotpop.com
    pedropal at supercable.es

More information about the jdom-interest mailing list