2. Elements are given serial numbers
Prev | Appendix B. Description of the XML differencing algorithm implemented in the Compare tool | Next

## 2. Elements are given serial numbers

The XML differencing algorithm implemented in the Compare tool requires all the elements to have a globally unique ID. This GUID, which is called a serial number, is assigned by XMLmind XML Editor (XXE for short) to an element during its lifetime and will not change no matter how you'll modify the content of this element.

Menu item Tools → Changes → Activate Change Detection merely instructs XXE to systematically assign a serial number to all the elements contained in the document being edited.

These serial numbers are all stored in a single `<?xxe-serial-numbers>` processing-instruction. This processing-instruction is added after the root element of the document. Example:

    <?xml version="1.0" encoding="UTF-8"?>

    <section version="5.0" xmlns="http://docbook.org/ns/docbook">
      <title>Pangrams</title>
      ...
    </section>

    <?xxe-serial-numbers guqrbopr john
    guqrevs5 bart
    (1z141z5 (1z141z6) (1z141z7 (3y283y9) (3y283ya)) (1z141z8) (3y283yb))?>

Notes:

- 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.

- The size of the `<?xxe-serial-numbers>` processing-instruction is proportional to the number of elements contained in a document. This size can be large, for example, 250Kb for a 2.1Mb DocBook document. However note that this size does not depend on the number of changes made to the document.

- Activating change detection should not slowdown XXE perceptibly. That's why there is an option which allows to automatically activate change detection in all the documents created and edited using XXE.

Prev | Up | Next
1. Comparison with other approaches | Home | 3. A simple XML differencing algorithm