Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDOM copy element without content

843834Feb 12 2007 — edited Feb 13 2007
Hi!
I like to copy an element X from an (input) JDOM document to become the root element of a new (output) JDOM document. I can do that. so far so good. Only the input JDOM I'm touching is quite lange and from the element to copy, the complete content (many other elements) gets copied aswell. But I need to copy just the start tag with it's attributes and the end tag. like:

Input JDOM

<Y>
<X abc="123" def="456">
<A xyz="234">
InhaltVonA
</A>
<B>
<C www="http"/>
</B>
</X>
</Y>


Output JDOM

<X abc="123" def="456">
</X>


How can I do that?

Cheers,
Marcello, Germany
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 13 2007
Added on Feb 12 2007
1 comment
321 views