How to merge two different child nodes in the same XML file
- by user814698
I have an XML file and I would like to merge two different CONTACT child nodes.
I have checked these websites it shows how to merge two different xml files into a single file.
http://www2.informatik.hu-berlin.de/~obecker/XSLT/#merge
Merge XML documents
In my case this is my first contact in the xml file:
<CONTACT>
<PDE-Identity>N65539</PDE-Identity>
<FirstName>Arun_niit</FirstName>
<LastName>Arun_niit</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>yahoo</Type>
<Value>[email protected]</Value>
</EMail>
</EMAILS>
</CONTACT>
This is the second contact in the file:
<PDE-Identity>N65567</PDE-Identity>
<FirstName>Arun_niit</FirstName>
<LastName>Ramanathan</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>gmail</Type>
<Value>[email protected]</Value>
</EMail>
<EMail>
<Type>yahoo</Type>
<Value>[email protected]</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
I know both of the contacts are belongs to the same person. How can i merge these two contacts in the same xml file.
Original XML File:
<?xml version="1.0" encoding="UTF-8"?>
<CONTACTS>
<CONTACT>
<PDE-Identity>N65539</PDE-Identity>
<FirstName>Arun_niit</FirstName>
<LastName>Arun_niit</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>yahoo</Type>
<Value>[email protected]</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
<PDE-Identity>N65567</PDE-Identity>
<FirstName>Arun_niit</FirstName>
<LastName>Ramanathan</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>gmail</Type>
<Value>[email protected]</Value>
</EMail>
<EMail>
<Type>yahoo</Type>
<Value>[email protected]</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
<PDE-Identity>N65567</PDE-Identity>
<FirstName>Rangarajkarthik</FirstName>
<LastName>karthik Rangaraj</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>gmail</Type>
<Value>[email protected]</Value>
</EMail>
<EMail>
<Type>yahoo</Type>
<Value>[email protected]</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACTS>