I have two xml files that I want to compare:
old.xml:
<EMPLOYEES>
<employee>
<id>102</id>
<name>Fran</name>
<department> THIS IS COMPUTER DEPARTMENT </department>
</employee>
<employee>
<id>105</id>
<name>Matthew</name>
<department> THIS IS SCIENCE AND TECHNOLOGY </department>
</employee>
</EMPLOYEES>
new.xml :
<EMPLOYEES>
<employee>
<id>105</id>
<name>Matthew</name>
<department> THIS IS SCIENCE AND TECHNOLOGY **Modified *** </department>
</employee>
<employee>
<id>106</id>
<name>xyz</name>
<department> THIS IS SCIENCE AND TECHNOLOGY </department>
</employee>
<employee>
<id>107</id>
<name>Francis</name>
<department> THIS IS XYZ </department>
</employee>
</EMPLOYEES>
I want to compare the two files and return which records were added, deleted, or updated. old.xml
contains 2 <employee>
records and new.xml
contains 3 <employee>
records.
I'd like the results to be like this:
Added records 2 : ex:- employee.id=106 and employee.id=107
Deleted records 1 : ex:- employee.id=102
Updated records 1: ex:- employee.id=105 updated with ----
What is the best way to diff these two XML files to get these results?