I need to compare two XML files with wildcard characters in those. I have looked at XMLUnit api (which was most suggested one when googled for comparing the result) but seems like it does not support what i am looking for.
To be precise I am looking for following:
I have one piece of XML like
<x>72</x>
<y>67</y>
and this should match with both the following listings
<x>72</x>
<y>67</y>
as well as
<x>*</x>
<y>67</y>
Notice the second listing, it contains a wildcard characters, that means it should ignore the contents and just match the structure.
Thanks in Advance.
XMLUnit allows you to get control at each detected difference (i.e. when it compares
*and72) and decide for yourself if the difference is significant. In your case you would look at the two values, see that one is*, and tell XMLUnit that the difference is not significant.For this you will have ti implement a custom listener and set that listener in to the difference object. Once some difference is found between xml node values, this listener will be called and there you can find out the two values which didn’t match and take evasive action there.