title: How to append ChildNodes of a xml documents into root of another (web services)?
body: <p>I've created a <code>[WebMethod]</code> on ASP.NET Web Service which reads XML documents from different web services (ASP.NET and PHP services).</p>
  
  <p>Once the documents are read, they are merged into a XML and returned. </p>
  
  <p>The method can successfully read XML documents from each web service but when I try to append second XML into first one, I get <code>ArgumentException</code> and a message like this <code>The node to be inserted is from a different document context.</code> I can't find a problem, can it be something to do with the source of document? but then both document are exactly same (have same elements).</p>
  
  <p>Why <code>ArgumentException</code>? What am I missing?</p>
  
  <pre><code>[WebMethod]
  public XmlDocument getRestaurants(String search_keywords)
  {
    XmlDocument xmlDom1 = new XmlDocument();
    xmlDom1 = getRestaurantFromAspNetWS(search_keywords);
  
    XmlTextReader myXmlTextReader = 
    new XmlTextReader
    ("http://some-iss.green.com/username/search.php?s=" + search_keywords);
  
    XmlDocument xmlDom2 = new XmlDocument();
    xmlDom2.Load(myXmlTextReader);
  
    foreach (XmlElement xmlNode in xmlDom2.DocumentElement.ChildNodes)
    {
       //trying to append childNodes of xmlDom2 into xmlDom1 
       //and this is where i get ArgumentException
       xmlDom1.DocumentElement.AppendChild(xmlNode);
    } 
  
    return xmlDom1;
  }  
  </code></pre>