From: Stefan B. <bo...@ap...> - 2008-11-11 12:57:10
|
On 2008-11-10, Edward Kawas <edw...@gm...> wrote: > My question is that I am using the RecursiveElementNameAndTextQualifier and > I noticed that if I try to compare 2 documents with one change in the child > nodes, then this qualifier works. However, I if I swap > 1 nodes, this > qualifier seems to fail. I am surprised that it works for one. Hmm, no, maybe I'm not. It works if you swap the last nodes (Q6PFF9 and Q8VHD0), but not if you swap the two that are further to the front of the document (B1AR77 and B1AR78), right? RecursiveElementNameAndTextQualifier says two elements are to be compared if the element names and nested texts (down many levels) match. It doesn't look at any attribute values. In the case of Q6PFF9 and Q8VHD0 theit textual contents and the values of an attribute differ, but XMLunit manages to match the correct elements to each other by just looking at the textual content. B1AR77 and B1AR78 only differ in their attribute values, RecursiveElementNameAndTextQualifier will say the elements can be compared in the order they appear in since they have the same textual content. What you'd need is an ElementQualifier implementation that used element names and attribute values to determine which elements to compare to each other. I'm afraid that no ready-made solution exists for this, you may want to take RecursiveElementNameAndTextQualifier as a source of inspiration 8-) > Also, I have a second question. If I use the > RecursiveElementNameAndTextQualifier, should I file and place it in my > project, or is that file guaranteed to persist? Even in my very theoretical and long overdue ideas of an XMLUnit 2.x rewrite I'd keep the examples around. They might move to a different jar but I don't see any reason to remove them from the distribution. Stefan |