This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Remove Parent of an element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Remove Parent of an element" Watch "Remove Parent of an element" New topic
Author

Remove Parent of an element

H Melua
Ranch Hand

Joined: Jan 04, 2005
Posts: 172
Hello ladies and gentlemen

I want to add an existing child-element as a root-element in another file... but i get this error


So i want to know how do i remove the parent of that child element so i can make it a root element...

Thanks :thumb:
HannaH
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Look at the javadocs for the org.w3c.dom.Node interface - particularly the cloneNode( true ) method. I suspect that is what you want but have not actually tried it.

Bill
H Melua
Ranch Hand

Joined: Jan 04, 2005
Posts: 172
Thank youu so much will
this method worked..
Element.clone()
:thumb:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Remove Parent of an element
 
Similar Threads
help , Concurrent Modification Exception
append an element to a text node using jdom?
retrieving object hierarchy - many-to-one?
dom4j inserting elements
XML Edior