[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

merging xml files

Subject: merging xml files
From: "Laura Jenkins" <xsl_list@xxxxxxxxxxx>
Date: Wed, 11 Sep 2002 08:57:28 +0000
xml merge results


i have got a fairly conplicated problem ( atleast for me :( )
i have got 3 xml files that contains university result data from 3 different regions.and i have to merge them into one xml with all the data from 3 xmls. The resultant XML should have the same structure as individual XMLs.
for example,
xml1:
<?xml version="1.0"?>
<university-records>
<univ-ids>
<univ id = "KSU">
<name>Kansas State University</name>
<location>Kansas<location>
</univ>
<univ id = "FAU">
<name>Florida Atlantic University</name>
<location>Florida<location>
</univ>
<univ id = "MSU">
<name> Mississipi State University</name>
<location> Mississipi <location>
</univ>
<univ id = "OSU">
<name>Ohio State University</name>
<location> Ohio <location>
</univ>
</univ-ids>
<university-results>
<university univ-id = "KSU">100%</university>
<university univ-id = "MSU">90%</university>
<university univ-id = "FAU">80%</university>
</university-results>
</university-records>


xml2:
<?xml version="1.0"?>
<university-records>
	<univ-ids>
		<univ id = "OSU">
			<name> Ohio State University</name>
			<location> Ohio <location>
		</univ>
		<univ id = "WSU">
			<name> Wisconsin state University</name>
			<location> Wisconsin <location>
		</univ>
		<univ id = "RPI">
			<name> Rensellar polytechnic Institute </name>
			<location> New Jersey <location>
		</univ>
		<univ id = "MSU">
			<name> Mississipi State University</name>
			<location> Mississipi  <location>
		</univ>
	</univ-ids>
	<university-results>
		<university univ-id = "OSU">70%</university>
		<university univ-id = "WSU">100%</university>
		<university univ-id = "RPI">100%</university>
	</university-results>
</university-records>
xml3:
<?xml version="1.0"?>
<university-records>
	<univ-ids>
		<univ id = "NSU">
			<name> Newyork State University</name>
			<location> Newyork <location>
		</univ>
		<univ id = "BU">
			<name> Belmont University</name>
			<location> Belmont <location>
		</univ>
		<univ id = "WSU">
			<name>Wisconsin state University</name>
			<location> Wisconsin <location>
		</univ>
		<univ id = "BCM">
			<name> Berklee College of Music</name>
			<location> Berklee <location>
		</univ>
	</univ-ids>
	<university-results>
		<university univ-id = "NU">70%</university>
		<university univ-id = "BU">60%</university>
		<university univ-id = "BCM">100%</university>
	</university-results>
</university-records>


i want the resultant xml to be ...


<university-records>
	<univ-ids>

		<univ id = "KSU">
			<name>Kansas State University</name>
			<location>Kansas<location>
		</univ>
		<univ id = "FAU">
			<name>Florida Atlantic University</name>
			<location>Florida<location>
		</univ>
		<univ id = "MSU">
			<name> Mississipi State University</name>
			<location> Mississipi <location>
		</univ>
		<univ id = "OSU">
			<name> Ohio State University</name>
			<location> Ohio <location>
		</univ>
		<univ id = "OSU">
			<name> Ohio State University</name>
			<location> Ohio <location>
		</univ>
		<univ id = "WSU">
			<name> Wisconsin state University</name>
			<location> Wisconsin <location>
		</univ>
		<univ id = "RPI">
			<name> Rensellar polytechnic Institute </name>
			<location> New Jersey <location>
		</univ>
		<univ id = "MSU">
			<name> Mississipi State University</name>
			<location> Mississipi  <location>
		</univ>
		<univ id = "NSU">
			<name> Newyork State University</name>
			<location> Newyork <location>
		</univ>
		<univ id = "BU">
			<name> Belmont University</name>
			<location> Belmont <location>
		</univ>
		<univ id = "WSU">
			<name>Wisconsin state University</name>
			<location> Wisconsin <location>
		</univ>
		<univ id = "BCM">
			<name> Berklee College of Music</name>
			<location> Berklee <location>
		</univ>

	</univ-ids>
	<university-results>
		<university univ-id = "NU">70%</university>
		<university univ-id = "BU">60%</university>
		<university univ-id = "BCM">100%</university>
		<university univ-id = "OSU">70%</university>
		<university univ-id = "WSU">100%</university>
		<university univ-id = "RPI">100%</university>
		<university univ-id = "KSU">100%</university>
		<university univ-id = "MSU">90%</university>
		<university univ-id = "FAU">80%</university>
	</university-results>
</university-records>


Things to be noticed here: The <univ-ids> in each of the xml files have some <univ-id> elements which are there in other xmls as well. for example the
<univ id = "MSU">
<name> Mississipi State University</name>
<location> Mississipi <location>
</univ>
which is in the xml2
similarly..
<univ id = "OSU">
<name> Ohio State University</name>
<location> Ohio <location>
</univ>
is there in both the xml files..


But The final XML should not reflect this.

Any Ideas as to how we can acheive this??

Thanks in advance..
laura

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.