The DocumentDiffService should expose extension points to
Configure XMLUnit for the diff, what is currently hard-coded:
protected void configureXMLUnit() { XMLUnit.setIgnoreWhitespace(true); XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true); }
Configure the diff itself, what is currently hard-coded:
protected void configureDiff(Diff diff) { diff.overrideDifferenceListener(new IgnoreStructuralDifferenceListener()); diff.overrideElementQualifier(new ElementNameAndAttributeQualifier()); }
Contribute a "second-level" differ for a given type of property.
The first-level diff detects the document properties that are different between the 2 docs, for example dc:title.
For now it also holds the different values on both sides: left and right, for example: {{
}}.
The second-level diff would use the type held by the first-level diff of a property to call the specific differ for this type on the document's property.
This implies a refactoring of the PropertyDiff implementations. The first-level diff no more needs to hold the different values, but the type of diff and a reference to the property itself (xpath like).
For example a structure like {{
}}.
This way to access the second-level diff for a property, the system would just have to call the appropriate differ contributed for the diff type. If no differ is associated to the diff type, a fallback is done on the default one.
Example of a contribution of a complexList differ:
<propertyDiffer type="complexList" class="ComplexListPropertyDiffer"/>