Hi Thiwanka, I believe removeChild() [1] is the method you're looking for. You can use that to detach "book" from its parent.
Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/Node.html#removeChild%28org.w3c.dom.Node%29 Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Thiwanka Somasiri <asthiwa...@gmail.com> wrote on 08/12/2011 04:50:52 AM: > Hi all, > > I need to detach the children of the DOM tree from the root > (where the result should be the sub tree of the initial tree). For example, > > Initial XML should be: > > <root> > <book> > <author>Foo</author> > </book> > </root> > > The resulting XML should be: > > <book> > <author>Foo</author> > </book> > > How can I acquire the this sub tree? > > Thanks. > -- > > Regards > > A.S.Thiwanka Somasiri > > Skype : executionerwild > MSN : thi...@ymail.com