472,791 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

Merging two XML Files

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.
Nov 12 '05 #1
2 3826
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
Nov 12 '05 #2
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.


http://www.gotdotnet.com/team/xmltools/default.aspx may help.

Cheers,

--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Stefan Franke | last post by:
Hi, I would like to merge two XML files. The first XML contains a list of books, the second XML file contains a bestseller list of books. So some of the books in the first file will appear in the...
2
by: Cy Huckaba | last post by:
I have an XML document that is linked to other document and I can't figure out what the best way to try and merge them before query qith an XpathNavigator. Simple example...a root xml document...
3
by: Mike | last post by:
Hi! I also asked this question in C# group with no results: I have 2 datasets loaded with data from two xml files having the same schema. The files contain data from yesterday and today. I'd...
0
by: steve | last post by:
Hi there, I am trying to import data from 2 dbf files into excel using the 'get external data' option which launches ms query. Ultimately I am merging data with a right join statement. I can...
0
by: Mike | last post by:
Hi! I have 2 datasets loaded with data from two xml files having the same schema. The files contain data from yesterday and today. I'd like to merge both datasets in such a way that the resulting...
10
by: n o s p a m p l e a s e | last post by:
Is it possible to merge two DLL files into one? If so, how? Thanx/NSP
1
by: adamrace | last post by:
Hi, I've got two excel files, one has a list of products and their current prices and they all have a product ID, I have another file with a list of price's that need updating. I was wondering...
0
by: veer | last post by:
Hello sir. I am making a program on merging in Visual Basic. The program is that I have a folder which is not on my hard drive contain 80 Mdb files and each Mdb file contains two tables. I want to...
0
by: Albert-jan Roskam | last post by:
Hi John, Thanks! Using a higher xlrd version did the trick! Regarding your other remarks: -yep, input files with multiple sheets don't work yet. I kinda repressed that ;-) Spss outputs only...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.