Hello ..
Can anyone give me code to merge multiple xml using dataset and xsl.
Write now i am using this code.. but I am not getting proper result.
private void Form1_Load(object sender, EventArgs e){
string xmlFolder = @"D:\MergeXML\zillowfiles";
//Call method which will read all XML files inside the Folder
MergeXML(xmlFolder);
//Finally write new XML from comon Dataset
dsAllFiles.WriteXml(xmlFolder + "\\" + "zillowcommon.xml");
}
private void MergeXML(string xmlFolder)
{
XmlTextReader xmlreader;
//There can be a lot of files in the Folder, so get only the zillow xml files from the Folder
DirectoryInfo rootFolder = new DirectoryInfo(xmlFolder);
FileInfo[] zillowFiles = rootFolder.GetFiles("*zillow.xml");
//Loop through the Folder for all zillow files
foreach (FileInfo fileInfo in zillowFiles)
{
SendFileForMerge(fileInfo.FullName);
}
}
private void SendFileForMerge(string zillowFile)
{
try
{
//Read Zillow file using XMLTextReader
XmlTextReader xmlTextReader = new XmlTextReader(zillowFile);
//Create a Dataset from XMLTextReader
DataSet dsTemp = new DataSet();
dsTemp.ReadXml(xmlTextReader);
//Merge created Dataset with common Dataset
dsAllFiles.Merge(dsTemp,false);
}
catch (System.Exception ex)
{
Console.Write(ex.Message);
}
}
}
Please tell me what i have to do ...