org.custommonkey.xmlunit
Class ElementNameAndAttributeQualifier

java.lang.Object
  extended by org.custommonkey.xmlunit.ElementNameQualifier
      extended by org.custommonkey.xmlunit.ElementNameAndAttributeQualifier
All Implemented Interfaces:
ElementQualifier

public class ElementNameAndAttributeQualifier
extends ElementNameQualifier

More complex interface implementation that tests two elements for tag name and attribute name comparability.
Examples and more at xmlunit.sourceforge.net

See Also:
DifferenceEngine.compareNodeList(NodeList, NodeList, int, DifferenceListener, ElementQualifier), Diff.overrideElementQualifier(ElementQualifier)

Constructor Summary
ElementNameAndAttributeQualifier()
          No-args constructor: use all attributes from all elements to determine whether elements qualify for comparability
ElementNameAndAttributeQualifier(java.lang.String attrName)
          Simple constructor for a single qualifying attribute name
ElementNameAndAttributeQualifier(java.lang.String[] attrNames)
          Extended constructor for multiple qualifying attribute names
 
Method Summary
protected  boolean areAttributesComparable(org.w3c.dom.Element control, org.w3c.dom.Element test)
          Determine whether the qualifying attributes are present in both elements and if so whether their values are the same
 boolean qualifyForComparison(org.w3c.dom.Element control, org.w3c.dom.Element test)
          Determine whether two elements qualify for further Difference comparison.
 
Methods inherited from class org.custommonkey.xmlunit.ElementNameQualifier
equalsNamespace, getNonNamespacedNodeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementNameAndAttributeQualifier

public ElementNameAndAttributeQualifier()
No-args constructor: use all attributes from all elements to determine whether elements qualify for comparability


ElementNameAndAttributeQualifier

public ElementNameAndAttributeQualifier(java.lang.String attrName)
Simple constructor for a single qualifying attribute name

Parameters:
attrName - the value to use to qualify whether two elements can be compared further for differences

ElementNameAndAttributeQualifier

public ElementNameAndAttributeQualifier(java.lang.String[] attrNames)
Extended constructor for multiple qualifying attribute names

Parameters:
attrNames - the array of values to use to qualify whether two elements can be compared further for differences
Method Detail

qualifyForComparison

public boolean qualifyForComparison(org.w3c.dom.Element control,
                                    org.w3c.dom.Element test)
Determine whether two elements qualify for further Difference comparison.

Specified by:
qualifyForComparison in interface ElementQualifier
Overrides:
qualifyForComparison in class ElementNameQualifier
Parameters:
differenceEngine - the DifferenceEngine instance wanting to determine if the elements are comparable
control -
test -
Returns:
true if the two elements qualify for further comparison based on both the superclass qualification (namespace URI and non- namespaced tag name), and the presence of qualifying attributes with the same values; false otherwise

areAttributesComparable

protected boolean areAttributesComparable(org.w3c.dom.Element control,
                                          org.w3c.dom.Element test)
Determine whether the qualifying attributes are present in both elements and if so whether their values are the same

Parameters:
control -
test -
Returns:
true if all qualifying attributes are present with the same values, false otherwise

XMLUnit is hosted by sourceforge.net