Page 1 of 1

Diff Files and Dirs: Add Ignore Element order for XML documents

Posted: Fri Feb 12, 2016 3:23 pm
by tatra603
Hello,

I would like to ask You to add a feature to Diff Files and Dirs. When perfoming diff of XML documents, I would like to be able to check Ignore Element order in the same style as Ignore Attribute order now.

Use case: The comparsion of XML documents produced by e. g. GUI, which saves XML output in different Elements order when just for example position of GUI's nodes are changed.

I already consulted it by Octavian on XML Prague 2016.

Thank You in advance, Stepan

Re: Diff Files and Dirs: Add Ignore Element order for XML documents

Posted: Fri Feb 12, 2016 5:11 pm
by florin
Hello,

I've just filed a new improvement request on our internal issue tracking system to add the possibility to ignore the order of the elements, similar to what already is done for attributes.

You'll be notified when this feature will be available.

Best Regards,
Florin

Re: Diff Files and Dirs: Add Ignore Element order for XML documents

Posted: Wed Oct 25, 2017 3:39 pm
by art
Hi Florin, out of curiosity (and because I could very well need this feature): Did your feature request make it to market? I use oxygen file diff v18 but do not seem to be able to diff xml files such that the change of order of neighbouring xml elements is not considered to be a difference. Cheers, Aaron.

Re: Diff Files and Dirs: Add Ignore Element order for XML documents

Posted: Mon Oct 30, 2017 9:53 am
by florin
Hello,

No, the feature is not available.

In the latest iterations to Diff tools, our developers concentrated on adding diff support between documents presented in the Author editing mode.
From what I know, implementing the requested feature is not a too easy job to do and there is no estimation about when it could be available.

Best regards,
Florin

Re: Diff Files and Dirs: Add Ignore Element order for XML documents

Posted: Wed May 29, 2019 9:37 am
by fireundubh
florin wrote: Mon Oct 30, 2017 9:53 am From what I know, implementing the requested feature is not a too easy job to do and there is no estimation about when it could be available.
It's actually pretty easy. I wrote a dirty hack in Python. My original brute-force approach:
  1. Allow the user to define an attribute or set of attributes that comprise the unique "signature" of each element tag.
  2. Generate element collections by recursively iterating through the elements of Documents A and B.
  3. Loop 1: Iterate through the B collection, generating a list of comparable elements from the A collection.
  4. Loop 2 (nested in L1): In each iteration of L1, iterate through the comparable elements, comparing each attribute value across A and B.
  5. Loop 3 (nested in L2): In each iteration of L2, collect a list of differences.
  6. In L2, print the result for that element (e.g., the element address in the tree, keys, and values) and break.
Surely your much more experienced and knowledgeable engineers can find a better solution after so many years.

edit: I've made a lot of improvements to my approach since late Tuesday. Here's what the output of my tool looks like:

Image

Re: Diff Files and Dirs: Add Ignore Element order for XML documents

Posted: Fri May 31, 2019 11:24 am
by tavy
Hello,

Thanks for your suggestion.
The comparison algorithms that we are using in Oxygen are very complex, in not a simple thing to ignore elements order. Anyway, we can change the algorithms to ignore the elements order, but this is not the only challenge, then we need to present the differences somehow in editor. The differences are presented in Oxygen side-by-side, and it is very possible that you will have cross changes. For example, one modification in bottom of the left document to be mapped to a modification in the right that is at the end of the document, and one from the end of the left document mapped to one modification from the bottom of the right editor..

Maybe one solution that we can provide more easily would be to rearrange the order of the elements in the editor based on the values of a specified attribute. We can make the "Format and Indent" action to sort the elements in a specific order.

Regards,
Octavian