XPath expressions will not help you find the differences between two XML trees.

At best you can iteratively probe the depth of the XML tree(s) using depth-limited XPath expressions like //[count(ancestor::*)=$depth] and look at whether you get a different number of nodes returned. Whether that produces a meaningful difference or not depends on the actual needs, which seem to be more along the line of a textual diff instead of a structural diff to me.

If you are making these suggestions in earnest, please also include code or concrete applications in pseudo-code, instead of "scare quotes" around verbs to suggest that you are talking about programming. Leaving it to the seekers to interpret your posts in a helpful way does not in fact help them achieve their goals.


In reply to Re^6: XML file difference highlights by Corion
in thread XML file difference highlights by PiyaPerl

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.