public interface DifferenceEngine
Modifier and Type | Method and 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 than
ComparisonResult.EQUAL . |
void |
addMatchListener(ComparisonListener l)
Registers a listener that is notified of each comparison with
outcome
ComparisonResult.EQUAL . |
void |
compare(Source control,
Source test)
Compares two pieces of XML and invokes the registered listeners.
|
void |
setAttributeFilter(Predicate<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(Map<String,String> prefix2Uri)
Establish a namespace context that will be used in
Comparison.Detail#getXPath . |
void |
setNodeFilter(Predicate<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.
|
void addComparisonListener(ComparisonListener l)
void addMatchListener(ComparisonListener l)
ComparisonResult.EQUAL
.void addDifferenceListener(ComparisonListener l)
ComparisonResult.EQUAL
.void setNodeMatcher(NodeMatcher n)
void setAttributeFilter(Predicate<Attr> attributeFilter)
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
.
void setNodeFilter(Predicate<Node> nodeFilter)
Only nodes for which the predicate returns true are part of the comparison. By default nodes that are not document types are considered.
void setDifferenceEvaluator(DifferenceEvaluator e)
void setComparisonController(ComparisonController c)
void setNamespaceContext(Map<String,String> prefix2Uri)
Comparison.Detail#getXPath
.
Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.
prefix2Uri
- maps from prefix to namespace URI.Copyright © 2001–2017 XMLUnit. All rights reserved.