识别XML文档差异的算法 [英] Algorithm for identifying differences in XML documents

查看:99
本文介绍了识别XML文档差异的算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用Java创建一个程序,该程序可以接收两个XML文件(一个是另一个的更新版本),并将它们带入主存储器。然后它将比较文件并计算两个对应节点(不包括空格)之间的差异数。程序稍后会在差异上做更多的事情,但是我只是对如何开始比较两个单独文件中的节点感到困惑。任何建议将不胜感激。

I'm trying to create a program in Java that takes two XML files (one is an updated version of the other) and takes them into main memory. It will then compare the files and count the number of differences between each corresponding node from the two (excluding white space). Later on the program will do more with the differences but I'm just confused on how to start comparing nodes from two separate files. Any suggestions would be much appreciated.

推荐答案

有关在每个节点上计算签名(哈希)以方便比较的算法,请参见 检测XML文档中的更改 >。

For an algorithm that computes signatures (hashes) at each node to facilitate comparison, see Detecting Changes in XML Documents.

有关元素顺序不重要的XML文档的更改检测,请参见 X-Diff:一种有效的XML文档变更检测算法 。 X-Diff算法的Java和C ++实现可以可用

For change detection on XML documents where element ordering is insignificant, see X-Diff: An Effective Change Detection Algorithm for XML Documents. Java and C++ implementations of the X-Diff algorithm are available.

这篇关于识别XML文档差异的算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆