Loading login details...

Merging XML documents and data: a DeltaXML solution

The requirement to merge XML data sets is becoming widespread. DeltaXML provides a flexible solution, which can be adapted to different needs.

There are two separate but related data merging problems: the 2-way merge and the 3-way merge. The difference between these depends on whether there are just two files to be merged, an master and a derivative, or whether there is also a 'base' file from which two others have been derived.

The classic 2-way merge scenario is illustrated below:

PIC-2-way-merge.gif

A 2-way merge can be achieved very easily with DeltaXML because a full delta contains all the data from the original files in a way that identifies common data, and clearly marks data which is different. A simple XSLT stylesheet can be run on the full delta file to generate a merged file. This deltaxml-merge.xsl stylesheet can be adapted to specific types of XML data, or to perform specific types of merge. Conflicts will be handled automatically; for example, if an attribute has different values in the two files, one or the values will be selected.

Where a base file exists, the 3-way merge illustrated below has the potential to provide a more accurate solution to reslovling conflicts, but processing is necessarily more complex:

PIC-3-way-merge.gif

A 3-way merge is more powerful because it provides a way to synchronize XML data that has been edited through two different processes. One example of this would be a system needing to synchronize changes made at different sites. Another application is where variants of a base XML file need to be updated whenever the base file is changed - automation of this can save considerable work and reduce errors. Multi-way merging is normally a complex operation requiring specialized code, but with XML and DeltaXML it can be achieved  easily using a generalized toolkit, opening up new opportunities.

Further details of how DeltaXML can achieve both the 2-way merge and the 3-way merge are provided in "Merging XML Changes with DeltaXML".