【发布时间】:2015-12-15 20:55:51
【问题描述】:
我需要这个来打补丁。我无法更改第一个 xml,但我可以应用 .xslt 从原始文件创建修补版本。
我应该使用哪些命令?
另外,哪个命令将从第一个 xml 和 xslt 创建第二个 .xml?
即我想要 MS XMLDiffPatch(~2002 年)之类的东西,但使用 XSLT 而不是 Diffgram(Xml Diff 语言)。
我预计 XSLT 已经完成了这样的工作。因为对于 RFC5261 (https://www.rfc-editor.org/rfc/rfc5261),它是在 2012 年(3 年前)完成的 - http://github.com/Bonuspunkt/XmlPatch
任何版本的 XSLT 都适用(即 2.0、3.0)。
该领域的一些理论著作:
- 2012,Egor Ivkin,树编辑距离算法的比较
https://is.cuni.cz/webapps/zzp/download/130082162/?lang=en - 2009,德梅因、莫泽斯、罗斯曼、魏曼。一种树编辑距离的最优分解算法
http://www.cs.haifa.ac.il/~oren/Publications/TEDinTALG.pdf - 2008,Beat Fluri,改变蒸馏。使用细粒度的源代码更改历史来丰富软件演化分析
http://www.zora.uzh.ch/16421/1/fluri_dissertation_2008.pdf - 2008,Daniel Ehrenberg,匹配、区分和合并 XML
http://useless-factor.blogspot.ru/2008/01/matching-diffing-and-merging-xml.html -
2007,乔·泰克利;理查德·切贝尔; Kokou Yetongnon,使用子树共性的高效 XML 结构相似性检测
http://le2i.cnrs.fr/IMG/publications/Efficient%20XML%20Structural%20Similarity%20Detection%20using%20Sub-tree%20Commonalities.pdf - 2001,加布里埃尔·瓦连特。树之间的有效自下而上距离
http://www.cs.upc.edu/~valiente/abs-spire-2001.pdf - 1998,Philip N. Klein,计算无根有序树之间的编辑距离
http://www.cs.brown.edu/research/pubs/pdfs/1998/Klein-1998-CED.pdf - 1996,Sudarshan S. Chawathe、Anand Rajaraman、Hector Garcia-Molina 和 Jennifer Widom,层次结构信息中的变化检测
http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf - 1995,David T. Barnard、Gwen Clarke、Nicholas Duncan,文档树的树到树校正
http://research.cs.queensu.ca/TechReports/Reports/1995-372.pdf - 1993,张凯中;丹尼斯·沙沙; Jason T. L. Wang,不关心可变长度的近似树匹配
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.36.2804&rep=rep1&type=pdf
(页面顺序颠倒 - 从底部阅读) -
1989, Kaizhong Zhang 和 Dennis Shasha,树间编辑距离的简单快速算法及相关问题
http://www.grantjenks.com/wiki/_media/ideas:simple_fast_algorithms_for_the_editing_distance_between_tree_and_related_problems.pdf
教程:http://www.youtube.com/watch?v=hwiks-n7vso - 1983,Walter F. Tichy,块移动的字符串到字符串校正问题
http://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=1377&context=cstech -
1979,Kuo-Chung Tai,树到树的校正问题
http://www.grantjenks.com/wiki/_media/ideas/treetotreecorrect.pdf - 1978,Paul Heckel,一种隔离文件差异的技术
http://documents.scribd.com/docs/10ro9oowpo1h81pgh1as.pdf
相关问题:
- Track changes to XML file in XSLT format
- How to correctly diff trees (that is, nested lists of strings)?
- Building an HTML Diff/Patch Algorithm
- Diff algorithms
- tree / diff-algorithm
- Calculate minimal operations to make two tree structures identical
- Diff Algorithm?
- Semantic Diff Utilities
- XML Diff and Merge
【问题讨论】:
-
太板了。您必须定义第一个和第二个文件的模式,然后编写 XSLT 来进行转换。并且没有办法将第二个文件“恢复”回第一个文件。您将不得不为该任务编写另一个 XSLT。
-
我不需要将第二个文件转换回第一个文件。我想要一个实用程序,它可以创建 .xslt 用于直接从第一个转换到第二个。
-
@ZoffDino,可能存在无损转换之类的东西,在这种情况下可以恢复,但确实需要另一个 XSLT 来完成。
-
看看 DeltaXML 产品。
-
亲爱的@user1709408,Abel 的回答是正确的,但也许如果您正在寻找一些有趣的算法,例如最小化更改或类似的,那么cs.stackexchange.com 等着您。