473,387 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

merge two xml file of the same structure

I have two xml files with the same structure
file1
<Topic>
<Child>
<wpf>
<Child>
<learn>
<Child>
</Child>
<Link>
<url>http://1.com</url>
</Link>
</learn>

<animation>
<Child>
</Child>
<Link>
<url>www.2.com</url>
</Link>
</animation>
</Child>
<Link>
<url>www.1up.com</url>
<url>www.2up.com</url>
</Link>
</wpf>
<csharp>
<Child></Child>
<Link></Link>
</csharp>
</Child>
<Link>
</Link>
</Topic>

File 2
<Topic>
<Child>
<wpf>
<Child>
<learn>
<Child>
</Child>
<Link>
<url>http://windowsclient.net/learn/video.aspx?v=55062</url>
</Link>
</learn>
</Child>
<Link>
</Link>
</wpf>
</Child>
<Link>
</Link>
</Topic>

How do i merge the two files so that the learn part looks like this

<learn>
<Child>
</Child>
<Link>
<url>http://1.com</url>
<url>http://windowsclient.net/learn/video.aspx?v=55062</url>
</Link>
</learn>
Oct 28 '08 #1
2 1282
SvenV
50
Doesn't look like the same structure to me. In the first file you have some different tags
Oct 28 '08 #2
File 1
<Contents version="0.8">
<Tag name="WPF">
<Children>
<Tag name="Visual Basic">
<Children></Children>
<Links>
<link source="http://www.yahoo.com" title="YAHOO"></link>
<link source="http://www.google.com" title="GOOGLE"></link>
<link source="http://www.live.com" title="LIVE"></link>
<link source="http://www.hello.com" title="Hello"></link>
</Links>
</Tag>
</Children>

<Links>
<link source="http://www.yahoo.com" title="YAHOO"></link>
<link source="http://www.google.com" title="GOOGLE"></link>
<link source="http://www.live.com" title="LIVE"></link>
</Links>
</Tag>
</Contents>

file 2
<Contents version="0.8">
<Tag name="WPF">
<Children>
<Tag name="Visual Basic">
<Children></Children>
<Links>
<link source="http://www.abc.com" title="YAHOO"></link>
<link source="http://www.google.com" title="GOOGLE"></link>
<link source="http://www.live.com" title="LIVE"></link>
<link source="http://www.hello.com" title="Hello"></link>
</Links>
</Tag>
<Tag name="C#">
<Children></Children>
<Links>
<link source="http://www.yahoo.com" title="YAHOO"></link>
<link source="http://www.google.com" title="GOOGLE"></link>
<link source="http://www.live.com" title="LIVE"></link>
</Links>
</Tag>
</Children>

<Links>
<link source="http://www.yahoo.com" title="YAHOO"></link>
<link source="http://www.google.com" title="GOOGLE"></link>
<link source="http://www.live.com" title="LIVE"></link>
</Links>
</Tag>
</Contents>
i would want the result to be something like this
<Tag name="Visual Basic">
<Children></Children>
<Links>
<link source="http://www.yahoo.com" title="YAHOO"></link>
<link source="http://www.google.com" title="GOOGLE"></link>
<link source="http://www.live.com" title="LIVE"></link>
<link source="http://www.hello.com" title="Hello"></link>
<link source="http://www.abc.com" title="YAHOO"></link>

</Links>
</Tag>
Oct 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Martin McNally | last post by:
My company maintains 40 replicated Sybase databases using a merge replication approach. It's difficult to update all 40 databases when a structure change occurs. Structure changes are minor,...
8
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
4
by: John J. Hughes II | last post by:
Could someone explain how to merge the form menu with the mdi container window. The menu strip items on the form window merge but I either end up with a blank blue menu on the form or top list of...
4
by: Andreas Kasparek | last post by:
Hola! I'm preparing my master thesis about a XML Merge Tool implementation and was wondering if there is any open standard for XML diff regarding topics like: - is a diff result computed on...
2
by: Benny Ng | last post by:
Dear All, Now i have a two dataset. they have same db structure and same columns and same rows. just the content is not same between them. for example: datagrid 1:
7
by: Defected | last post by:
Thanks all for help, I have tried this code but it's don't work. -------------------------------------------------------------------- Structure typedef struct{ int atomic_number; char...
4
by: Tom Jones | last post by:
I have an application that was originally built using Visual Studio 2003 that I upgraded to Visual Studio 2005. When I attempt to build the *.msi file in the deployment project, I am getting a...
7
by: giladp1 | last post by:
I found Albert Kallal's great "Super easy Word Merge" code in his site at: http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html Thanks Albert so much for sharing this. I am looking...
1
by: Esther Lane | last post by:
Hello! First off, many many thanks to Albert who wrote the Mail Merge code for MS Access I am using. It has been working beautifully for a few years. However, my client just (without notice!)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.