AnsweredAssumed Answered

How to separate contry name as per Region from xml

Question asked by sriramakrishna.chittabathina302209 on May 5, 2017
Latest reply on May 5, 2017 by prashant.tiwari718253

I've Input as

 

<PEGA_XML>
<PEGA>
<Region_Countries>
<Region>
<Region_Name>AMERICA</Region_Name>
<Countries>ARGENTINA</Countries>
<Region_Name>AMERICA</Region_Name>
<Countries>COLOMBIA</Countries>
<Region_Name>AMERICA</Region_Name>
<Countries>COSTA RICA</Countries>
<Region_Name>AMERICA</Region_Name>
<Countries>MEXICO</Countries>
<Region_Name>AMERICA</Region_Name>
<Countries>PERU</Countries>
<Region_Name>AMERICA</Region_Name>
<Countries>URUGUAY</Countries>
<Region_Name>AFRICA</Region_Name>
<Countries>Somalia</Countries>
</Region>
</Region_Countries>
</PEGA>
</PEGA_XML>

 

-----------------------------------------------------------------------------------------
and my required output is 

 

<?xml version='1.0' encoding='UTF-8'?>
<PEGA_XML>
<PEGA>
<Region_Countries>
<Region>
<Region_Name>AMERICA</Region_Name>
<Countries>
<Country>ARGENTINA</Country>
<Country>COLOMBIA</Country>
<Country>COSTA RICA</Country>
<Country>MEXICO</Country>
<Country>PERU</Country>
<Country>URUGUAY</Country>
</Countries>
</Region>
<Region>
<Region_Name>AFRICA</Region_Name>
<Countries>
<Country>Somalia</Country>
</Countries>
</Region>
</Region_Countries>
</PEGA>
</PEGA_XML>

Outcomes