xmldiff wrongly thinks a node was renamed
sebastienvercammen opened this issue · comments
May be related to #62.
The suggested diff is not only suggesting wrong the changes, applying it as a patch would actually result in the wrong XML.
Original input (left
):
<LootClass Name="LC_trash">
<Pick Value="1" />
<Level Value="1" />
<NoDrop Value="19" />
</LootClass>
Changed file (right
):
<LootClass Name="LC_trash">
<Pick Value="1" />
<Level Value="1" />
<NoDrop Value="10" />
</LootClass>
Diff output XML (XMLFormatter
):
<LootClass Name="LC_trash">
<Pick Value="1"/>
<Level Value="1"/>
<NoDrop Value="10" diff:insert="" diff:rename="Level" diff:update-attr="Value:1"/>
<NoDrop Value="19" diff:delete=""/>
</LootClass>
This supposed "rename + delete" of NoDrop
is just an attribute change.
Applying the rename+update-attr
would result in a duplicate <Level>
node.
I've even tried using uniqueattrs
according to the docs hoping it would help xmldiff
understand what node it should match, but no luck.
Using:
normalize=formatting.WS_BOTH
diff_options={
'uniqueattrs': [
'{http://www.w3.org/XML/1998/namespace}id',
'Name',
('NoDrop', 'Value'),
('Level', 'Value')
],
'ratio_mode': 'accurate'
}
I can't reproduce this.