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

In reply to Re: Comparison of XML files ignoring ordering of child elements by GrandFather
in thread Comparison of XML files ignoring ordering of child elements by adikan123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.