By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

Merging XML documents

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.