Menu

Move node and all its children?

2005-03-16
2013-05-20
  • Andrew Ziem

    Andrew Ziem - 2005-03-16

    What is an easy way to move a node and all its children and attributes and attach it to a different part of the XML document?  

    If I could orphan a node here and graft it there, that would do the trick.

     
    • Lee Thomason

      Lee Thomason - 2005-03-22

      Not as efficiently as you state..I think the following should work:

      newNode = existing.Clone();
      existingParent.RemoveChild( existing )

      which will give you a copy and get rid of the old one.

      Does that work?
      lee

       
    • Andrew Ziem

      Andrew Ziem - 2005-03-28

      Yes, I think that works.  Thank you.

       

Log in to post a comment.