From: <slo...@gm...> - 2008-03-11 13:59:45
|
-------- Original-Nachricht -------- Datum: Tue, 11 Mar 2008 14:54:06 +0100 Von: slo...@gm... An: Stefan Bodewig <bo...@ap...> Betreff: Re: [Xmlunit-general] qualifyForComparison() is ignored? Hi Stefan, thank you for your quick reply. Well, it appears that I have misinterpreted the purpose of ElementQualifier. Is the expectation to get a message like "Element <c0...> at location /a0[1]/b0[1]/c0[1] in the control document does not have a match in the test document." wrong? If I get a message like "Expected node type '1' but was '8' - comparing <c0...> at /a0[1]/b0[1]/c0[1] to <!-- some comment --> at /a0[1]/b0[1]/comment()[1]", do I have to interpret this as there is no <c0...> in the test document that matches /a0[1]/b0[1]/c0[1] in the control document? This time I try to disguise my proof of concept as a PDF file, which needs to be renamed to "xmlunit_issue.zip". Regards, slowjoe Sorry, did not reply to the mailing list. Doing so now. -------- Original-Nachricht -------- > Datum: Tue, 11 Mar 2008 13:16:15 +0100 > Von: Stefan Bodewig <bo...@ap...> > An: xml...@li... > Betreff: Re: [Xmlunit-general] qualifyForComparison() is ignored? > Hi, > > On Tue, 11 Mar 2008, slowjoe <slo...@gm...> 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 > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen! Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx -- Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games! http://games.entertainment.gmx.net/de/entertainment/games/free |