views:

465

answers:

2

I want to be able to do a 3-way merge of XHTML documents:

  1. Start with some original copy of the document
  2. One user edits a copy of the original document
  3. Another user edits a separate copy of the original document
  4. Need a tool to merge (automatically and/or visually) the changes made by the two users.

Note:

  • I want to include this functionality in commercial software: so I prefer something that's free-as-in-beer and/or open source, instead of a commercial tool.
  • I suspect it's better if the tool is XML-aware, than to try to use software like diff3 which implements 3-way merge of flat text
  • Given that all three input documents are valid XHTML documents, the resulting output document should validate too

Tools I've found include:

  1. The "3DM" XML 3-way Merging and Differencing Tool
  2. Fuego Core XML Diff and Patch Tool
  3. XmlDiff (lately from the GotDotNet site which has been shut down, but maybe it's living on as a component of XML Notepad)

The first of the above (i.e. "3DM") says explicitly that it implements 3-way merges.

I don't know about the other two: whether "diff" followed by "patch" is equivalent to a 3-way merge, or instead whether "patch" can only reapply the diff to the original file (and not to a third, altered copy of the file)

Can you recommend some software (from the list above, or elsewhere) for this purpose, and/or a description of a merge algorithm?


Edit: Matching, diffing and merging XML is another article from 2008, which includes a brief survey of various algorithms and references to various implementations.


Edit #2: The author confirmed that the Fuego Core XML Diff and Patch Tool can only patche the original file, and doesn't implement 3-way merging.

+2  A: 

I can add to your collection DeltaXML - they do not claim diff3, but worse considering.

dma_k
Thanks: they introduce their 3-way merge for XML at http://www.deltaxml.com/dxml/products/sync/index.html
ChrisW
+1  A: 

I don't have a free solution, I'm afraid, but Project: Merge is a cheap XML comparison and merge tool which can be controlled through the command line. It could probably plug straight in to your application.

James