Thanks Stefan. The qualifier works for me. Actually I had overridden it wrongly with some other qualifier.
[not identical] Expected number of child nodes '4' but was '3' - comparing <div...> at /html[1]/body[1]/div[1] to <div...> at /html[1]/body[1]/div[1] [different] Expected element tag name 'x' but was 'div' - comparing <x...> at /html[1]/body[1]/div[1]/x[1] to <div...> at /html[1]/body[1]/div[1]/div[1] [not identical] Expected number of element attributes '0' but was '1' - comparing <x...> at /html[1]/body[1]/div[1]/x[1] to <div...> at /html[1]/body[1]/div[1]/div[1] [not identical] Expected attribute name 'null' but was 'class' - comparing <x...> at /html[1]/body[1]/div[1]/x[1] to <div...> at /html[1]/body[1]/div[1]/div[1] [different] Expected presence of child nodes to be 'false' but was 'true' - comparing <x...> at /html[1]/body[1]/div[1]/x[1] to <div...> at /html[1]/body[1]/div[1]/div[1] [not identical] Expected sequence of child nodes '0' but was '1' - comparing <x...> at /html[1]/body[1]/div[1]/x[1] to <div...> at /html[1]/body[1]/div[1]/div[1] [not identical] Expected attribute value '1232' but was '123' - comparing <a href="1232"...> at /html[1]/body[1]/div[1]/a[1]/@href to <a href="123"...> at /html[1]/body[1]/div[1]/a[1]/@href [not identical] Expected sequence of child nodes '1' but was '0' - comparing <a...> at /html[1]/body[1]/div[1]/a[1] to <a...> at /html[1]/body[1]/div[1]/a[1] [not identical] Expected attribute value 'top' but was 'bottom' - comparing <div class="top"...> at /html[1]/body[1]/div[1]/div[1]/@class to <div class="bottom"...> at /html[1]/body[1]/div[1]/div[2]/@class [not identical] Expected text value 'top' but was 'bottom' - comparing <div ...>top</div> at /html[1]/body[1]/div[1]/div[1]/text()[1] to <div ...>bottom</div> at /html[1]/body[1]/div[1]/div[2]/text()[1] [not identical] Expected sequence of child nodes '3' but was '2' - comparing <div...> at /html[1]/body[1]/div[1]/div[2] to <div...> at /html[1]/body[1]/div[1]/div[2] ----- Original Message ---- From: Stefan Bodewig <[EMAIL PROTECTED]> To: [email protected] Sent: Friday, 16 November, 2007 8:27:21 PM Subject: Re: [Xmlunit-general] Missing elements On Fri, 16 Nov 2007, vamsidhar sharma <[EMAIL PROTECTED]> wrote: > Hi xmlunit users, > > Had a question regarding the behaviour of XMLUnit in the below > scenario: > > Control Doc = > <div class="main"> > <x/> > <a href="1232"/> > <div class="top">top</div> > <div class="bottom">bottom</div> > </div> > > Test Doc = > <div class="main"> > <a href="123"/> > <div class="top">top</div> > <div class="bottom">bottom</div> > </div> > > Looking at the docs. it is clear that 'x' tag is missing in test > doc. Below is the report that XMLUnit that is generated. > From 2nd line I could infer that 'x' is missing element. > However, when control reaches 'a' in control doc. it is compared > with 'div' in test doc. By default XMLUnit matches each node in the control document against the node that appears "at the same place" in the test document. What you want is that XMLUnit compares elements with the closest element that has the same name. To achieve that, you want to use an ElementNameQualifier, see <http://xmlunit.sourceforge.net/userguide/html/ar01s03.html#ElementQualifier>. Stefan ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Xmlunit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xmlunit-general Now you can chat without downloading messenger. Go to http://in.messenger.yahoo.com/webmessengerpromo.php ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Xmlunit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xmlunit-general
