title: VB.NET inserting xml nodes into an existing XML document
body: <p>I'm simply trying to merge 2 xml documents (adding nodes from one into the other).  I've done some Google searching, and tried a few things, but I always get the same error "The node to be inserted is from a different document context"</p>
  
  <p>I'm sure I'm missing something simple, just seems like this should not be that difficult.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>    Dim xmlDoc482 As XmlDocument = New XmlDocument
      Dim xmlDoc486 As XmlDocument = New XmlDocument
      Dim xmlDoc490 As XmlDocument = New XmlDocument
  
      xmlDoc482.LoadXml(strSettlement482)
      xmlDoc486.LoadXml(strSettlement486)
      xmlDoc490.LoadXml(strSettlement490)
  
      Dim xmlSummarysNode490 As XmlNode = xmlDoc486("Summarys")
      Dim xmlSummaryNode482 As XmlNode = xmlDoc482("Summarys").LastChild
      Dim xmlSummaryNode486 As XmlNode = xmlDoc486("Summarys").LastChild
  
      Dim nodeDest As XmlNode
      nodeDest = xmlDoc490.ImportNode(xmlSummaryNode482, True)
      xmlSummarysNode490.AppendChild(nodeDest)
  
      nodeDest = xmlDoc490.ImportNode(xmlSummaryNode486, True)
      xmlSummarysNode490.AppendChild(nodeDest)
  </code></pre>