473,385 Members | 2,029 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,385 software developers and data experts.

Merging XML documents

Hi

I would really appreciate any assistanance with the following situation.

Lets say i have 2+ documents A,B,...n that i need to merge together, such
that the resulting documents contains totals or sum of the common elements.

For example:

Doc A

<employees>
<emp ID="1" Items="20">emp 1 name</emp>
<emp ID="2" Items="15">emp 2 name</emp>
<emp ID="3" Items="5">emp 3 name</emp>
</employees>

Doc B
<employees>
<emp ID="1" Items="15">emp 1 name</emp>
<emp ID="2" Items="5">emp 2 name</emp>
<emp ID="5" Items="55">emp 5 name</emp>
</employees>

Doc A + Doc B
<employees>
<emp ID="1" Items="35">emp 1 name</emp>
<emp ID="2" Items="20">emp 2 name</emp>
<emp ID="3" Items="5">emp 3 name</emp>
<emp ID="3" Items="55">emp 3 name</emp>
</employees>

How may i best go about this?, considering perfomance as well.

Thank you in advance.
Aug 31 '06 #1
2 1348
Here pl confirm the 2 things..
1) Do you want only the attribute "ID" to be compared or
2) Once ID is compared, you wanted to add the "Items" attribute and remove
the extra element in the resulted doc....

Correct me if i'm mistaken ..

--
Every thing is perfect, as long as you share!!!
"Garikayi Mukombachoto" wrote:
Hi

I would really appreciate any assistanance with the following situation.

Lets say i have 2+ documents A,B,...n that i need to merge together, such
that the resulting documents contains totals or sum of the common elements.

For example:

Doc A

<employees>
<emp ID="1" Items="20">emp 1 name</emp>
<emp ID="2" Items="15">emp 2 name</emp>
<emp ID="3" Items="5">emp 3 name</emp>
</employees>

Doc B
<employees>
<emp ID="1" Items="15">emp 1 name</emp>
<emp ID="2" Items="5">emp 2 name</emp>
<emp ID="5" Items="55">emp 5 name</emp>
</employees>

Doc A + Doc B
<employees>
<emp ID="1" Items="35">emp 1 name</emp>
<emp ID="2" Items="20">emp 2 name</emp>
<emp ID="3" Items="5">emp 3 name</emp>
<emp ID="3" Items="55">emp 3 name</emp>
</employees>

How may i best go about this?, considering perfomance as well.

Thank you in advance.
Aug 31 '06 #2
I want to compare the id and add the attributes. the resultant document
should contain names from both documents. Nothing is to be removed.

"Chakravarthy" <ds******@india.comwrote in message
news:2A**********************************@microsof t.com...
Here pl confirm the 2 things..
1) Do you want only the attribute "ID" to be compared or
2) Once ID is compared, you wanted to add the "Items" attribute and remove
the extra element in the resulted doc....

Correct me if i'm mistaken ..

--
Every thing is perfect, as long as you share!!!
"Garikayi Mukombachoto" wrote:
>Hi

I would really appreciate any assistanance with the following situation.

Lets say i have 2+ documents A,B,...n that i need to merge together, such
that the resulting documents contains totals or sum of the common
elements.

For example:

Doc A

<employees>
<emp ID="1" Items="20">emp 1 name</emp>
<emp ID="2" Items="15">emp 2 name</emp>
<emp ID="3" Items="5">emp 3 name</emp>
</employees>

Doc B
<employees>
<emp ID="1" Items="15">emp 1 name</emp>
<emp ID="2" Items="5">emp 2 name</emp>
<emp ID="5" Items="55">emp 5 name</emp>
</employees>

Doc A + Doc B
<employees>
<emp ID="1" Items="35">emp 1 name</emp>
<emp ID="2" Items="20">emp 2 name</emp>
<emp ID="3" Items="5">emp 3 name</emp>
<emp ID="3" Items="55">emp 3 name</emp>
</employees>

How may i best go about this?, considering perfomance as well.

Thank you in advance.

Aug 31 '06 #3

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

Similar topics

1
by: Dan Nash | last post by:
Hi guys I wonder if you could help. I'm trying to create a bespoke interface for mail merging from an Access database in Word. At the moment, I'm just trying it with CSV files, and it works....
1
by: Mael Guillemot | last post by:
Hi, I have one xml looking like this: ========================= <video> <shot id="1"> <timestampbegin>000030.90</timestampbegin> <feature>blabla</feature>...
3
by: William Ahern | last post by:
I'm looking for resources on splitting and merging XML trees. Specifically, on methods to pare large XML documents into smaller documents which can be merged later. Off of the top of my head, I...
2
by: North Country Boy | last post by:
Hi I'm trying to run the mail merge operation in MS Word from within Javascript. I've already done this in VB but I'm having problems trying to do the same thing in Javascript. First I am trying...
2
by: Marina | last post by:
Anyone know of any 3rd party components that can allow for programmatic merging of Word documents? Also one that does the same for Excel spreadsheets? Really looking for something that can just...
4
by: rottyguy70 | last post by:
hello, am trying to do the following with little success. any help is appreciated. 1) assume i have a static mapping: a -> 1 b -> 2 c -> 3 2) i need to read through some data, let's say...
3
by: Patrick | last post by:
I have got 2 XML documents, both of which conform to the same XSD Schema, which define possible optional elements. The 2 XML documents contain 2 disjoint set of XML elements. What is the best,...
0
by: Maheshwari | last post by:
Hi Can you please help with some info on how to open existing word documents / merge two word documents from a C# program ? My user will select 2 or many word docs and i have to create a c# exe...
0
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.