To copy node between XmlDocuments use importnode:
// Store the root node of the destination document into an XmlNode
// The 1 in ChildNodes[1] is the index of the node to be copied (where 0 is the first node)
XmlNode rootDest = myDestDoc["DestinationRoot"];
// Store the node to be copied into an XmlNode
XmlNode nodeOrig = mySourceDoc["SourceRoot"].ChildNodes[1];
// Store the copy of the original node into an XmlNode
XmlNode nodeDest = myDestDoc.ImportNode(nodeOrig, true);
// Append the node being copied to the root of the destination document

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.