I have two XML files. The structure of both XML files is as below:
<file1>
<table>
<name>...</name>
<columns>
<col>
<name>...</name>
<type>...</type>
<fkey>...</fkey>
</col>
<col>
<name>...</name>
<type>...</type>
<fkey>...</fley>
</col>
<columns>
</table>
<table>
<name>...</name>
<columns>
<col>
<name>...</name>
<type>...</type>
<fkey>...</fkey>
</col>
<col>
<name>...</name>
<type>...</type>
<fkey>...</fley>
</col>
<columns>
</table>
</file1>
Both the XML files will have same tables, but the number of columns can differ. What I am trying to do is compare each column of each table and find the difference(if any) in type and fkey. Also I would like to know which columns are missing from second XML file. And I want to save this info to another file(it can be any format).
I know Perl,PHP and JavaScript but I haven’t worked with XML before.
Now what I want to know is where to start and which tools to use? What would be the best way to do above task? Is there any module which provide functions to perform diff between two XML files?
EDIT: I am working on Linux platform(RedHat).
For a Perl solution take a look at the related CPAN modules.
XML::Diffis the most obvious and seems to do what you need, but there are several to try if that doesn’t work for you.