SemanticDiff icon indicating copy to clipboard operation
SemanticDiff copied to clipboard

Add XML support

Open bannmann opened this issue 1 year ago • 5 comments

It would be great to have support for XML.

My use case is comparing WSDL files that unfortunately have different attribute ordering (which the XML spec says is irrelevant). In this situation, every other diff tool I know fails, even difftastic (see issue Wilfred/difftastic#758).

SemanticDiff, on the other hand, could easily treat the following files as equal (just like the Python example from the docs):

<foo bar="1" quux="true"/>
<foo quux="true" bar="1"/>

bannmann avatar Aug 31 '24 10:08 bannmann

We already have an issue for XML support but it was always a bit unclear whether generic XML support would be useful. The spec does not really define when two documents are identical (with the exception of attribute reordering) and it is mostly up to application specific logic. If there are actual use cases that can benefit from generic rules (ignoring whitespace at the beginning/end of values or attribute reordering) we can take a look into adding support.

mmueller2012 avatar Aug 31 '24 14:08 mmueller2012

Duplicate of #18

mmueller2012 avatar Aug 31 '24 14:08 mmueller2012

And please also add ignoring spaces before the closing tag . I need to do XSLT comparison which is basically an XML document and some of my tools add such a space like e.g. here: "<Data />". It is valid XML but it really drives me crazy to see that being flagged as a valid diff.

williwusel avatar Sep 02 '24 13:09 williwusel

We just released SemanticDiff 0.10.0 which adds support for XML. It should handle both cases mentioned by @bannmann and @williwusel. Please give it a try and report back if it works for you.

mmueller2012 avatar Jan 08 '25 12:01 mmueller2012

Looks like it works now for me

williwusel avatar Jan 09 '25 12:01 williwusel