Hi,

On Tue, 11 Mar 2008, slowjoe <[EMAIL PROTECTED]> wrote:

> I tried to start small and therefore was filtering differences of
> nodes of type "c0" only.
> 
> My "qualifyForComparison()" implementation is this:

qualifyForComparision as in "I implemented ElementQualifier", right?

ElementQualifier is not the right place for filtering.  Let me first
explain what ElementQualifier does and then try to find a better place
for you to hook in.

Let's say XMLUnit finds a collection of child elements of a given XML
element, then ElementQualifier will tell it which of the child
elements of the control document should be compared to which child
element of the test document.  It's job is to say "yes, this control
element can be compared to this test element", it cannot say "skip
this element", it doesn't say anything about the element's equality
and it will never be invoked for anything but DOM Elements.

OK.  So where do you hook in?

I'd say DifferenceListener is what you want.

Implement DifferenceListener and tell XMLUnit to ignore all
Differences that are related to parts that you are currently not
interested in.

Looking at you code

>                 String controlID = control.getAttribute("id");
>                 if (controlID != null)
>                 {
>                     result = controlID.equals(test.getAttribute("id"));
>                 }

You will probably still need an ElementQualifier so that you can tell
XMLUnit to match your "c0" elements based on their id-Attribute
values.  ElementNameAndAttributeQualifier may or may not work in your
case (depends on the other attributes).

Cheers

        Stefan

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to