aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 12675
    
    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


Java Resources at www.wbrogden.com
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
retrieving object hierarchy - many-to-one?
help , Concurrent Modification Exception
append an element to a text node using jdom?
XML Edior
dom4j inserting elements