Class MultiLevelElementNameAndTextQualifier
java.lang.Object
org.custommonkey.xmlunit.examples.MultiLevelElementNameAndTextQualifier
- All Implemented Interfaces:
ElementQualifier
Per popular request an interface implementation that uses element
names and the text node containes in the n'th child node to compare
elements.
This means ElementNameQualifier
and MultiLevelElementNameQualifier(1) should
lead to the same results.
Any attribute values are completely ignored. Only works on elements with exactly one child element at each level.
This class mostly exists as an example for custom ElementQualifiers.
-
Constructor Summary
ConstructorDescriptionMultiLevelElementNameAndTextQualifier
(int levels) Uses element names and the text nestedlevels
child elements deeper into the element to compare elements.MultiLevelElementNameAndTextQualifier
(int levels, boolean ignoreEmptyTexts) Uses element names and the text nestedlevels
child elements deeper into the element to compare elements. -
Method Summary
Modifier and TypeMethodDescriptionboolean
qualifyForComparison
(Element control, Element test) Determine whether two elements are comparable
-
Constructor Details
-
MultiLevelElementNameAndTextQualifier
public MultiLevelElementNameAndTextQualifier(int levels) Uses element names and the text nestedlevels
child elements deeper into the element to compare elements.Does not ignore empty text nodes.
- Parameters:
levels
- level of nesting to use when looking up the text
-
MultiLevelElementNameAndTextQualifier
public MultiLevelElementNameAndTextQualifier(int levels, boolean ignoreEmptyTexts) Uses element names and the text nestedlevels
child elements deeper into the element to compare elements.- Parameters:
levels
- level of nesting to use when looking up the textignoreEmptyTexts
- whether whitespace-only textnodes should be ignored.
-
-
Method Details
-
qualifyForComparison
Description copied from interface:ElementQualifier
Determine whether two elements are comparable- Specified by:
qualifyForComparison
in interfaceElementQualifier
- Parameters:
control
- an Element from the control XML NodeListtest
- an Element from the test XML NodeList- Returns:
- true if the elements are comparable, false otherwise
-