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

Are you missing a feature? Request it's implementation here.
tatra603
Posts: 72
Joined: Fri Sep 17, 2004 10:53 am
Location: Prague, the Czech Republic, Europe

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

Post by tatra603 » Fri Feb 12, 2016 3:23 pm

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

florin
Posts: 55
Joined: Wed Jan 05, 2011 10:36 am

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

Post by florin » Fri Feb 12, 2016 5:11 pm

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
Florin Avram
<oXygen/> XML Editor

art
Posts: 20
Joined: Fri Nov 14, 2008 8:21 am

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

Post by art » Wed Oct 25, 2017 3:39 pm

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.

florin
Posts: 55
Joined: Wed Jan 05, 2011 10:36 am

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

Post by florin » Mon Oct 30, 2017 9:53 am

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
Florin Avram
<oXygen/> XML Editor

fireundubh
Posts: 1
Joined: Wed May 29, 2019 7:59 am

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

Post by fireundubh » Wed May 29, 2019 9:37 am

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

tavy
Posts: 179
Joined: Thu Jul 01, 2004 12:29 pm

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

Post by tavy » Fri May 31, 2019 11:24 am

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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply