我有两个 XML 文件,一个是旧的 XML 文件,另一个是新的 XML 文件。我想打印文件之间的差异
我想要这样的输出:
如果内容将程度更改为 B.com,则这是更新的数据
如果属性发生变化,则视为新添加的数据
示例输出:
UPDATED DATA:
in the "joindef" in the entry name =
"Hardware" in the option name ="Graduation" content Degree was changed to B.com
NEWLY ADDED DATA:
in the "join_def" entry name "VHDL" is added.
in the "join_def" in the entry name "Software" option name "Location" is added.
旧 XML 文件:
<ls_new>#mainblock
<new_def>#subblock1
............
............
............
</new_def>
<join_def>
<entry name="Software">
<option name="Graduation">B.tech</option>
<member>year=2011</member>
<option name="PostGraduation">M.tech</option>
<option name="JobNum">50</option>
</entry>
<entry name="Hardware">
<option name="Graduation">Degree</option>
<member>year=2011</member>
<option name="PostGraduation">MCA</option>
<option name="JobNum">100</option>
</entry>
</join_def>
<old_def>#subblock3
............
............
............
</old_def>
</ls_new>
新 XML 文件:
<ls_new>#mainblock
<new_def>#subblock1
............
............
............
</new_def>
<join_def>
<entry name="Software">
<option name="Graduation">B.tech</option>
<member>year=2011</member>
<option name="PostGraduation">M.tech</option>
<option name="JobNum">50</option>
<option name="Location">india</option>
</entry>
<entry name="Hardware">
<option name="Graduation">B.com</option>
<member>year=2011</member>
<option name="PostGraduation">MCA</option>
<option name="JobNum">100</option>
</entry>
<entry name="VHDL">
<option name="Graduation">B.com</option>
<member>year=2011</member>
<option name="PostGraduation">MCA</option>
<option name="JobNum">150</option>
</entry>
</join_def>
<old_def>#subblock3
............
............
............
</old_def>
</ls_new>
我是 Perl 的新手。谁能帮我解决这个问题?