| # XMLmind XML Editor - Online Help |

### 11.1. Why use the Compare tool?

The Compare tool allows to compare two revisions of the same initial document.

Unlike generic XML comparison tools such as DeltaXML or Altova DiffDog,

- you must explicitly activate the change detection[20] in the initial document if you want to be able to compare two revisions using the Compare tool. This activation is made by selecting menu item Tools → Changes → Activate Change Detection.

- Moreover, adding or deleting elements using a text or XML editor other than XXE will cause the change detection to be automatically deactivated the next time you'll reopen the document in XXE. Any other kind of change, for example text or attribute changes, poses no problem.

After selecting menu item Tools → Changes → Compare Revisions in order to display it, the Compare tool will show you the differences existing between two revisions. It also allows to accept or reject some or all the changes.

Figure 7.8. The Compare tool showing the differences existing between `doc.xml` (the initial document) and `docB.xml` (a revision of `doc.xml`), displayed side by side

#### 11.1.1. A common use case

This tool is typically used by an author after her/his draft document has been reviewed and possibly modified by other authors. For example, let's suppose that john has finished writing `doc.xml`.

John activates the change detection in `doc.xml` using Tools → Changes → Activate Change Detection, saves the document to disk and then sends a copy to Bart and to Charles.

Bart modifies his copy. He also adds a remark explaining some of his changes using Tools → Remark → Insert or Edit Remark. This results in creating `docB.xml`, a revision of `doc.xml`.

Note that Bart didn't even notice that the change detection has been activated in the copy of `doc.xml` he has received. The use of this facility should be completely transparent to the user of XXE, even in terms of perceived performances.

Charles modifies his copy. This results in creating `docC.xml`, another revision of `doc.xml`. Charles sends `docC.xml` to Dana, who also modifies the document. This results in creating revision `docCD.xml`.

The Compare tool allows to compare two by two any revision of `doc.xml` (`doc.xml`, `docB.xml`, `docC.xml`, `docCD.xml`) to another and this, regardless of the order of creation of a revision. For example, the Compare tool allows to compare `docB.xml` (here considered to be the reference document) to `doc.xml` (here considered to be the revised copy). Other example, it allows to compare `docCD.xml` (here considered to be the reference document) to `docB.xml` (here considered to be the revised copy).

After the review of the document by Bart, Charles and Dana is finished, John receives `docB.xml` and `docCD.xml`.

John first compares `doc.xml` to `docB.xml`, accepts some changes and reject other changes, then saves `docB.xml` to disk.

Then he compares the “approved” `docB.xml` to `docCD.xml`. Here too, he accepts some changes and reject other changes, then saves `docCD.xml` to disk.

Finally John renames the “approved” `docCD.xml` to `doc.xml` and deletes all his other working copies[21].

[20] Appendix B, Description of the XML differencing algorithm implemented in the Compare tool will explain you why.

[21] Alternatively, John could have compared `docB.xml` (here considered to be the reference document) to `doc.xml` (here considered to be the revised copy), inverting the logic of accepting and rejecting the changes. Then John would have compared `docCD.xml` (here considered to be the reference document) to the now modified `doc.xml` (here considered to be the revised copy), also inverting the logic of accepting and rejecting the changes.