Class MultiLevelElementNameAndTextQualifier
- java.lang.Object
-
- org.custommonkey.xmlunit.examples.MultiLevelElementNameAndTextQualifier
-
- All Implemented Interfaces:
ElementQualifier
public class MultiLevelElementNameAndTextQualifier extends java.lang.Object implements 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.
-
-
Field Summary
Fields Modifier and Type Field Description private ElementSelector
es
-
Constructor Summary
Constructors Constructor Description MultiLevelElementNameAndTextQualifier(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
qualifyForComparison(org.w3c.dom.Element control, org.w3c.dom.Element test)
Determine whether two elements are comparable
-
-
-
Field Detail
-
es
private final ElementSelector es
-
-
Constructor Detail
-
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.
-
MultiLevelElementNameAndTextQualifier
public MultiLevelElementNameAndTextQualifier(int levels, boolean ignoreEmptyTexts)
Uses element names and the text nestedlevels
child elements deeper into the element to compare elements.- Parameters:
ignoreEmptyTexts
- whether whitespace-only textnodes should be ignored.
-
-
Method Detail
-
qualifyForComparison
public boolean qualifyForComparison(org.w3c.dom.Element control, org.w3c.dom.Element test)
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
-
-