Nikhil Prashar wrote:
I'm trying to merge two XML files that have the same structure but not
necessarily the same nodes in the same order. I've tried opening the files as
datasets and using the DataSet.Merge() function, but this only "fumbles" the
data together and puts children under the wrong parent nodes. How else could
I go about merging the files? I'm using C# .NET.
This depends on your schema.
If it is very simple, you could use two 'XmlReader's, read from them and
write that data into one XmlWriter.
For example this:
<root>
<item id="234"><some/><data/></item>
...
</root>
You just read all the nodes from the two files, ignore the root-Elements
and write them into the new file into a newly created root-Element...
For more complex files you could maybe use XSLT...
--
Pascal Schmitt