This Article shows how to merge two XML files and make use of a single XML inorder to make the process simpler.

Here XMLDocument is used in order to transfer the nodes from one XML to the other. So first step is to open the XML using the XML Document as shown below

Code
System.Xml.XmlDocument objFirstXML = new XmlDocument();
Code
objFirstXML.Load("C:\\temp\\XML1.xml");
Similar way we open the second XML using the XMLDocument.

Code
System.Xml.XmlDocument objSecondXML = new XmlDocument();
Code
objSecondXML.Load("C:\\temp\\XML2.xml");

Here once we open the xml now search for the node and then append it to the main one
Code
XmlNode objInsert = objFirstXML.SelectSingleNode("/XMLROOT/CHILD");
Code
foreach( XmlNode objNode in objInsert.SelectNodes("/XMLROOT/CHILD/CHILDITEM"))
Code
{
Code
    objInsert.AppendChild(objSecondXML.ImportNode(objNode,true));
Code
}
Code
objFirstXML.Save("C:\\temp\\Merged.xml");