Skip to content

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

  • DMNDI section (shape positions, diagram layout) — use --xml to see these
  • extensionElements — vendor-specific content
  • exporter / exporterVersion — tool metadata
  • XML attribute order, comments, BOM, encoding declaration

Normalization before comparison

Before diffing, both models are normalized:

Raw formNormalized to
CDATA <![CDATA[> 5]]>XML text > 5
Empty <inputEntry/>text: "-" (wildcard)
hitPolicy absent"UNIQUE"
isCollection absentfalse
preferredOrientation absent"Rule-as-Row"
hitPolicy="unique""UNIQUE" (uppercase)
Leading/trailing whitespace in <text>trimmed
BOM \uFEFFremoved

Released under the MIT License.