All the replies you have so far assume that you want an error generated if the two documents have the same elements but in a different order:
<root>
<data>first</data>
<data>second</data>
</root>
and
<root>
<data>second</data>
<data>first</data>
</root>
should fail to match. However, although it's not clear, your question implies to me that you would like those two documents to match. That is what XML::SemanticDiff's documentation and name implies to me that it does, but the current version doesn't behave as I would expect. The module's documentation doesn't spell out the er, um, semantics of the comparison process so I suspect my expectations differ from the author's intentions.
The module documentation does suggest the possibility of changing the way detected differences are handled which opens up the possibility that we could put our own spin on the matching process. But there are no examples and, without diving into the module's source code, how the handlers get hooked up is not at all clear.
Bottom line: being very clear about what you mean is important both when asking questions and when documenting code. Well constructed example code and data goes a very long way toward helping with clarity. If what you want is the diff I describe let us know and show us your current test code, because at present that's not the sort of answer you are getting!
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
|