I want to be able to do a 3-way merge of XHTML documents:
- Start with some original copy of the document
- One user edits a copy of the original document
- Another user edits a separate copy of the original document
- 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:
- The "3DM" XML 3-way Merging and Differencing Tool
- Fuego Core XML Diff and Patch Tool
- 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.