| Author |
Merging repeted elements in XML
|
Manoj Jena
Greenhorn
Joined: Aug 31, 2011
Posts: 3
|
|
Hi,
I have an xml file with the following content.
<abc>
<a>
<b/>
</a>
<c>
<d/>
</c>
</abc>
<abc>
<a>
<b/>
</a>
<e>
<f/>
<g>
<h/>
</g>
</e>
<i/>
</abc>
I want to merge these 2 in to one, like the below.
<abc>
<a>
<b/>
</a>
<c>
<d/>
</c>
<e>
<f/>
<g>
<h/>
</g>
</e>
<i/>
</abc>
Appreciate any help on this and can I do this using DOM parser ?
Thanks,
Manoj
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Your first step would be to figure out how to identify "repeated" elements. Once you have done that, then yes, you should be able to do it with DOM programming.
|
 |
Manoj Jena
Greenhorn
Joined: Aug 31, 2011
Posts: 3
|
|
Hi,
I don't have a specific pattern and the xml provided is only part of the huge XML that I have.
Thanks,
MJ
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Okay. So your problem is solved then?
|
 |
Manoj Jena
Greenhorn
Joined: Aug 31, 2011
Posts: 3
|
|
Not yet looking for a feasible solution on this. Appreciate any sample code on this.
Thanks,
MJ
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
You are asking for code? That means you must have completed your requirements, which include a description of how to identify duplicate elements.
But if you think about it, we don't know what you decided there. So asking for code to do that is rather useless. Why don't you post the rules for identifying duplicate elements, and we can discuss that? Don't expect anybody to write the code for you, though, that isn't how this forum works.
|
 |
 |
|
|
subject: Merging repeted elements in XML
|
|
|