Package org.xmlunit.diff
Interface DifferenceEngine
-
- All Known Implementing Classes:
AbstractDifferenceEngine
,DOMDifferenceEngine
public interface DifferenceEngine
XMLUnit's difference engine.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addComparisonListener(ComparisonListener l)
Registers a listener that is notified of each comparison.void
addDifferenceListener(ComparisonListener l)
Registers a listener that is notified of each comparison with outcome other thanComparisonResult.EQUAL
.void
addMatchListener(ComparisonListener l)
Registers a listener that is notified of each comparison with outcomeComparisonResult.EQUAL
.void
compare(javax.xml.transform.Source control, javax.xml.transform.Source test)
Compares two pieces of XML and invokes the registered listeners.void
setAttributeFilter(Predicate<org.w3c.dom.Attr> attributeFilter)
Sets the optional strategy that decides which attributes to consider and which to ignore during comparison.void
setComparisonController(ComparisonController c)
Determines whether the comparison should stop after given difference has been found.void
setDifferenceEvaluator(DifferenceEvaluator e)
Evaluates the severity of a difference.void
setNamespaceContext(java.util.Map<java.lang.String,java.lang.String> prefix2Uri)
Establish a namespace context that will be used inComparison.Detail#getXPath
.void
setNodeFilter(Predicate<org.w3c.dom.Node> nodeFilter)
Sets the optional strategy that decides which nodes to consider and which to ignore during comparison.void
setNodeMatcher(NodeMatcher n)
Sets the strategy for selecting nodes to compare.
-
-
-
Method Detail
-
addComparisonListener
void addComparisonListener(ComparisonListener l)
Registers a listener that is notified of each comparison.
-
addMatchListener
void addMatchListener(ComparisonListener l)
Registers a listener that is notified of each comparison with outcomeComparisonResult.EQUAL
.
-
addDifferenceListener
void addDifferenceListener(ComparisonListener l)
Registers a listener that is notified of each comparison with outcome other thanComparisonResult.EQUAL
.
-
setNodeMatcher
void setNodeMatcher(NodeMatcher n)
Sets the strategy for selecting nodes to compare.
-
setAttributeFilter
void setAttributeFilter(Predicate<org.w3c.dom.Attr> attributeFilter)
Sets the optional strategy that decides which attributes to consider and which to ignore during comparison.Only attributes for which the predicate returns true are part of the comparison. By default all attributes are considered.
The "special" namespace, namespace-location and schema-instance-type attributes can not be ignored this way. If you want to suppress comparison of them you'll need to implement
DifferenceEvaluator
.
-
setNodeFilter
void setNodeFilter(Predicate<org.w3c.dom.Node> nodeFilter)
Sets the optional strategy that decides which nodes to consider and which to ignore during comparison.Only nodes for which the predicate returns true are part of the comparison. By default nodes that are not document types are considered.
-
setDifferenceEvaluator
void setDifferenceEvaluator(DifferenceEvaluator e)
Evaluates the severity of a difference.
-
setComparisonController
void setComparisonController(ComparisonController c)
Determines whether the comparison should stop after given difference has been found.
-
setNamespaceContext
void setNamespaceContext(java.util.Map<java.lang.String,java.lang.String> prefix2Uri)
Establish a namespace context that will be used inComparison.Detail#getXPath
.Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.
- Parameters:
prefix2Uri
- maps from prefix to namespace URI.
-
compare
void compare(javax.xml.transform.Source control, javax.xml.transform.Source test)
Compares two pieces of XML and invokes the registered listeners.
-
-