Merge Formatting Element Representations
Inline formatting elements (such as bold, italic, or hyperlinks) present a special challenge for XML merge because their boundaries — the start and end tags — may shift across different versions of a document in ways that create overlapping hierarchies in the merge output.
The Problem
Consider a paragraph where:
-
The ancestor has:
The <b>quick brown</b> fox -
Version A changes to:
The <b>quick</b> brown fox -
Version B changes to:
The quick <b>brown</b> fox
The bold element boundaries are different in all three versions. A standard merge cannot produce well-formed XML output for all three states simultaneously without special handling.
How Merge Handles Formatting Elements
Merge uses a specialised algorithm for elements configured as formatting elements. The algorithm:
-
Identifies the text content within and around the formatting elements.
-
Represents the merge result using
deltaxml:formatwrapper elements that capture each version's formatting state. -
Ensures the output is always well-formed XML, even when formatting boundaries overlap.
Configuration
For formatting XML Merge, see Merge Formatting Elements Sample, which makes use of the extension point to implement Formatting elements. In DITA Merge, the JAVA API and configuration files for the REST API can be used.
Limitations
-
The Merge REST API does not support formatting elements.
-
When using the command-line tool or Java API, formatting elements must be explicitly configured.