Shoobx / xmldiff

A library and command line utility for diffing xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Too many changes when deleting

Kyllian176 opened this issue · comments

Hello, I tried to delete a "subelement" in a xml file :

File1.xml :
<alldatas> <text>random</text> <issue> <first>false</first> <second>false</second> </issue> <cancelData>false</cancelData> <client/> <time>0</time> </alldatas>

File2.xml :
<alldatas> <text>random</text> <issue> <first>false</first> </issue> <cancelData>false</cancelData> <client/> <time>0</time> </alldatas>

I tried : xmldiff file1.xml file2.xml

I expected the following result :
[delete, /alldatas/issue/second[1]] (something like that)
But I got :
[move, /alldatas/issue/second[1], /alldatas[1], 2] [rename, /alldatas/second[1], cancelData] [delete, /alldatas/cancelData[2]]

Is there any way to deal with "subelements" ? It works fine if I delete for example.

Thanks in advance.

With simple XML data with no attributes the content of the data is important, and the two nodes here have the same content, and then these things happens. In this case using --fast-match and making a simpler comparison actually gets better results, but in real world examples that's less common.

I have tweaked exactly how to calculate matches to be more generically useful, and there probably will be further changes in the future, but there will never be a perfect matching algorithm for all use cases.

Thanks a lot for your quick answer. --fast-match seems to provide what I expected, I will look further with this option.
Thanks again.