Hi there I have been trying to work out how to get xmlunit to do what I want.
I have the following xml String xml1 = "<parent><child id=\"1\">value1</child><child id=\"2\">value2</child></parent>"; String xml2 = "<parent><child id=\"3\">value3</child><child id=\"1\">value1 changed</child></parent>"; What I want is to make xmlunit find a differences between elements that have the same id (1) and inform me of missing or new elements (2,3) using the id attribute. I have implemented a custom qualifier that returns false if the element tag names dont match or if the ids dont match but xmlunit doesnt seem to be taking notice of it. I have also tried the ElementNameAndAttributeQualifier passing "id" in the constructor but I get the same result. What it does is Expected text value 'value1' but was 'value1 changed' - comparing <child ...>value1</child> at /parent[1]/child[1]/text()[1] to <child ...>value1 changed</child> at /parent[1]/child[2]/text()[1] Expected sequence of child nodes '0' but was '1' - comparing <child...> at /parent[1]/child[1] to <child...> at /parent[1]/child[2] Expected sequence of child nodes '1' but was '0' - comparing <child...> at /parent[1]/child[2] to <child...> at /parent[1]/child[1] Expected attribute value '2' but was '3' - comparing <child id="2"...> at /parent[1]/child[2]/@id to <child id="3"...> at /parent[1]/child[1]/@id Expected text value 'value2' but was 'value3' - comparing <child ...>value2</child> at /parent[1]/child[2]/text()[1] to <child ...>value3</child> at /parent[1]/child[1]/text()[1] How can I get xmlunit to say find the first difference and also inform me that node child id="2" is missing and that child id="3" is new Any help would be greatly appreciated Thanks in advance -- Stefanos Kollias Departamento de Enxeñería do Software [email protected] ---------------------------------------------------------------------- imaxin|software Salgueiriños de Abaixo 11, L6 15703 Santiago de Compostela Voz +34 981 554 068 Fax +34 981 554 988 [email protected] ---------------------------------------------------------------------- www.imaxin.com ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Xmlunit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xmlunit-general
