Release Documentation

Move Handling sample

1. Introduction

DeltaXML products do not, by default, understand moved content, e.g. the reordering of sections in a document. When sections move positions relative to one another, one of them is marked as dekleted and then added again in its new location. While this is technically correct, it is not possible to easily see if there were any changes that took place at the same time as the move.

2. Switching on move support

To turn on move support, simply use the detect-moves parameter on the command-line, or the setDetectMoves() method in the API. As long as the moved items have an id attribute (or xml:id for DocBook 5), moves can be identified.

3. Running the sample

The sample directory contains an Ant file as well as a shell script and.bat file for running the sample files, with and without move detection enabled. The following sections describe how to make use of these.

3.1. Running the sample using Ant

If you hav Apache ant available on your path, simply navigate to the sample directory and run the following command:

ant

The build file runs two comparisons; one without move detection enabled, and one with it switched on. Viewing the two result files enables you to easily see the effect that the parameter has on the result.

To clean up the sample directory and remove the result files, run the following command:

ant clean

3.2. Running the sample from the Command-line

It is possible to compare two DocBook files using the command line tool from this directory as follows, where '\' is a line continuation character.

java -jar ../../deltaxml-docbook.jar compare \
                version1.xml  version2.xml result.xml \
                indent=yes detect-moves=true

The result.xml file contains the result, which identifies one of the sections as a move. The result is explained more fully in the text of the result itself.

Other parameters are available as discussed in the User Guide and summarised by the following command

java -jar ../../deltaxml-docbook.jar describe

For an example of using the java/.Net API to call the comparison see the FileCompare sample.