Compare 2 XML files and generate the comparison excel sheet or CSV file



I guess this will be duplicate requirement, but i could not get an exact solution for my need. I want to compare 2 XML files which will share a common primary key value.



<?xml version="1.0" encoding="utf-8" ?>
<Positions>
<Position>
<Tax ID=#001 Name="BRK" Sale="30" Gain=10/>
<Tax ID=#002 Name="NETFLEX" Sale="20" Gain=15/>
<Tax ID=#003 Name="STARG2" Sale="10" Gain=30/>
<Tax ID=#004 Name="JETLAB" Sale="0" Gain=0/>
</Position>
<Positions>


Second XML



<?xml version="1.0" encoding="utf-8" ?>
<Positions>
<Position>
<Tax ID=#001 Name="BRK" Sale="30" Gain=10/>
<Tax ID=#002 Name="NETFLEX_Se2" Sale="30" Gain=0/>
<Tax ID=#003 Name="STARG2" Sale="30" Gain=0/>
</Position>
<Positions>


Result wanted (comparison of 2 in excel or csv file) enter image description here


I had implemented a logic with for loop, please suggest a better method. Thanks


No comments:

Post a Comment