title: How can I copy nodes from one xml file into another?
body: <p>I would like to copy a parent node and children nodes from one xml file to another. In the example below, I would like to copy Items from file #2 into file #1:</p>
  
  <p>Input file #1:</p>
  
  <pre><code>&lt;Top&gt;
    &lt;Items&gt;
      &lt;Item&gt;one&lt;/Item&gt;
      &lt;Item&gt;two&lt;/Item&gt;
    &lt;/Items&gt;
  &lt;/Top&gt;
  </code></pre>
  
  <p>Input file #2:</p>
  
  <pre><code>&lt;Top&gt;
    &lt;Items&gt;
      &lt;Item&gt;three&lt;/Item&gt;
      &lt;Item&gt;four&lt;/Item&gt;
    &lt;/Items&gt;
  &lt;/Top&gt;
  </code></pre>
  
  <p>I want the final XML file to look like the following:</p>
  
  <pre><code>&lt;Top&gt;
    &lt;Items&gt;
      &lt;Item&gt;one&lt;/Item&gt;
      &lt;Item&gt;two&lt;/Item&gt;
    &lt;/Items&gt;
    &lt;Items&gt;
      &lt;Item&gt;three&lt;/Item&gt;
      &lt;Item&gt;four&lt;/Item&gt;
    &lt;/Items&gt;
  &lt;/Top&gt;
  </code></pre>
  
  <p>I attempted the following non-functional code. The InsertAfter call does not work across xml files. Any help?</p>
  
  <pre><code>XmlDocument prev = new XmlDocument(); prev.Load(filename1);
  XmlDocument curr = new XmlDocument(); curr.Load(filename2);
  XmlNode prev_node = prev.SelectSingleNode("Items");
  XmlNode curr_node = curr.SelectSingleNode("Items");
  prev.InsertAfter(curr_node, prev_node);
  </code></pre>
  
  <p>Many Thanks!</p>