Semantic diff
Identity by ID
The fundamental principle: elements are matched by their XML id attribute.
id equal → same element, compare content
id missing → element removed
id new → element added
no id → fallback: LCS by position (rules) or by key (bindings, contextEntries)This means:
- Reordering rules in a decision table produces zero diff (IDs are stable)
- Changing an ID is treated as remove + add (by design)
- Purely cosmetic XML changes (attribute order, whitespace, CDATA vs entities) produce zero diff
What gets compared
Every element with an id in both files is compared field-by-field. The fields compared depend on the element type (see Types).
Elements without id fall back to:
- Rules → LCS (Longest Common Subsequence) by position
- Bindings → matched by
parameter.name - ContextEntries → matched by
variable.name - AnnotationEntries → matched by position
What is ignored
DMNDIsection (shape positions, diagram layout) — use--xmlto see theseextensionElements— vendor-specific contentexporter/exporterVersion— tool metadata- XML attribute order, comments, BOM, encoding declaration
Normalization before comparison
Before diffing, both models are normalized:
| Raw form | Normalized to |
|---|---|
CDATA <![CDATA[> 5]]> | XML text > 5 |
Empty <inputEntry/> | text: "-" (wildcard) |
hitPolicy absent | "UNIQUE" |
isCollection absent | false |
preferredOrientation absent | "Rule-as-Row" |
hitPolicy="unique" | "UNIQUE" (uppercase) |
Leading/trailing whitespace in <text> | trimmed |
BOM \uFEFF | removed |
