Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Compare 2 xml files ignoring elements/attribute order and list out only the differences in the report using c#

$
0
0

Hi All,

Iam new to this field and i was assigned with a challenging task. I have 2 xml files as shown below and i need to compare the Item Sections in both the xml files ignoring the elements/attribute order and display only the differences. Kindly help me on the same:

Source Xml:

<?xml version="1.0" encoding="utf-8"?><CUSTOMSEDI xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.dell.com/dbi/fsl/compliance/v1_0"><ASNNUM>SXMSEO180814001D</ASNNUM><ORDERS><ORDER><CUSID>743828552</CUSID><CUSADDRESS>KLS Tokyo Terminal3-2-31 Yashio, Shinagawa, TokyoJapanJapan</CUSADDRESS><ORDERNUM>979793524</ORDERNUM><CITY /><TIES><TIE><TIENUMBER>1</TIENUMBER><TIEQTY>1</TIEQTY><ITEMS><ITEM><ITEMNUMBER>KF3P2</ITEMNUMBER><ITEMQTY>1</ITEMQTY><ITEMDES>CUS,CBL,DNGL,HDMITOVGA,O,DBP</ITEMDES><ENMARKETINGDESC>Kit - Dell HDMI to VGA Adapter - S&amp;amp;P</ENMARKETINGDESC><TYPE>BASE</TYPE><PRICE>8.27</PRICE></ITEM><ITEM><ITEMNUMBER>60RD2</ITEMNUMBER><ITEMQTY>1</ITEMQTY><MOD>KF3P2</MOD><ITEMDES>CUS,CBL,DNGL,HDMITOVGA,O,DBP</ITEMDES><ENMARKETINGDESC>Kit - Dell HDMI to VGA Adapter - S&amp;amp;P</ENMARKETINGDESC><TYPE>INVOICE</TYPE><PRICE>8.27</PRICE></ITEM></ITEMS></TIE></TIES></ORDER><ORDER><CUSID>743828552</CUSID><CUSADDRESS>KLS Tokyo Terminal3-2-31 Yashio, Shinagawa, TokyoJapanJapan</CUSADDRESS><CUSCOUNTRY>JP</CUSCOUNTRY><CUSNAME>743828552</CUSNAME><ORDERNUM>979794834</ORDERNUM><CITY /><TIES><TIE><TIENUMBER>1</TIENUMBER><TIEQTY>1</TIEQTY><ITEMS><ITEM><ITEMNUMBER>K850M</ITEMNUMBER><ITEMQTY>1</ITEMQTY><ITEMDES>CUS,CORD,PWR,12A,2M,JPN,JMPR</ITEMDES><ENMARKETINGDESC>Kit - Jumper Cord, 12A,2M,C13/C14 (Japan)</ENMARKETINGDESC><TYPE>BASE</TYPE><PRICE>1.54</PRICE></ITEM><ITEM><ITEMNUMBER>T732H</ITEMNUMBER><ITEMQTY>1</ITEMQTY><MOD>K850M</MOD><ITEMDES>CUS,CORD,PWR,12A,2M,JPN,JMPR</ITEMDES><ENMARKETINGDESC>Kit - Jumper Cord, 12A,2M,C13/C14 (Japan)</ENMARKETINGDESC><TYPE>INVOICE</TYPE><PRICE>1.54</PRICE></ITEM></ITEMS></TIE></TIES></ORDER></ORDERS>

Final Xml:

<?xml version="1.0" encoding="utf-8"?><CUSTOMSEDI xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.dell.com/dbi/fsl/compliance/v1_0"><ASNNUM>SXMSEO180814001D</ASNNUM><ORDERS><ORDER><CUSID>744400014</CUSID><CUSADDRESS>KLS Tokyo Terminal3-2-31 Yashio, Shinagawa, TokyoJapan</CUSADDRESS><ORDERNUM>979794834</ORDERNUM><TIES><TIE><TIENUMBER>1</TIENUMBER><TIEQTY>1</TIEQTY><ITEMS><ITEM><ITEMNUMBER>T732H</ITEMNUMBER><ITEMQTY>1</ITEMQTY><MOD>K850M</MOD><ITEMDES>CUS,CORD,PWR,12A,2M,JPN,JMPR</ITEMDES><ENMARKETINGDESC>Kit - Jumper Cord, 12A,2M,C13/C14 (Japan)</ENMARKETINGDESC><TYPE>INVOICE</TYPE><PRICE>1.54</PRICE></ITEM><ITEM><ITEMNUMBER>K850M</ITEMNUMBER><ITEMQTY>1</ITEMQTY><ITEMDES>CUS,CORD,PWR,12A,2M,JPN,JMPR</ITEMDES><ENMARKETINGDESC>Kit - Jumper Cord, 12A,2M,C13/C14 (Japan)</ENMARKETINGDESC><TYPE>BASE</TYPE><PRICE>1.54</PRICE></ITEM></ITEMS></TIE></TIES></ORDER><ORDER><CUSID>743138972</CUSID><CUSADDRESS>KLS Tokyo Terminal3-2-31 Yashio, Shinagawa, TokyoJapan</CUSADDRESS><ORDERNUM>979793524</ORDERNUM><TIES><TIE><TIENUMBER>1</TIENUMBER><TIEQTY>1</TIEQTY><ITEMS><ITEM><ITEMNUMBER>60RD2</ITEMNUMBER><ITEMQTY>1</ITEMQTY><MOD>KF3P2</MOD><ITEMDES>CUS,CBL,DNGL,HDMITOVGA,O,DBP</ITEMDES><ENMARKETINGDESC>Kit - Dell HDMI to VGA Adapter - S&amp;P</ENMARKETINGDESC><TYPE>INVOICE</TYPE><PRICE>8.27</PRICE></ITEM><ITEM><ITEMNUMBER>KF3P2</ITEMNUMBER><ITEMQTY>1</ITEMQTY><ITEMDES>CUS,CBL,DNGL,HDMITOVGA,O,DBP</ITEMDES><ENMARKETINGDESC>Kit - Dell HDMI to VGA Adapter - S&amp;P</ENMARKETINGDESC><TYPE>BASE</TYPE><PRICE>8.27</PRICE></ITEM></ITEMS></TIE></TIES></ORDER></ORDERS>

Thanks,

Ram


ram


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>