On Mon, 23 Oct 2023 at 23:12, Srdjan Todorovic todorovic.s@googlemail.com wrote:
On Mon, 23 Oct 2023 at 22:51, mick mbm@rlogin.net wrote:
Try "sorting" the files before the diff.
Not really something I'd recommend. You'd want something that's XML-aware.
Agreed. Yes it would work in my limited example but the actual files are more complex and a simple sort could give misleading results.
Also: I should clarify that I'm not just looking for a "are they the same?" comparison but also a meaningful summary of where the differences are, which an xmldiff tool would most likely have given some thought to.
A very quick search shows this, might be useful?
I did try this yesterday, and it does get close, but this is a sample of its output: [move, /template/output[4], /template[1], 14] [move, /template/output[4], /template[1], 15] [delete-attribute, /template/output[1], desc] [delete-attribute, /template/output[2], desc] [delete-attribute, /template/output[3], desc] [delete-attribute, /template/output[4], desc] [delete-attribute, /template/output[5], desc] [delete-attribute, /template/output[6], desc] [delete-attribute, /template/output[7], desc] [delete-attribute, /template/output[8], desc] [move, /template/output[8]/field[14], /template/output[8], 14] [move, /template/output[5]/field[1], /template/output[4], 0] ...
I suspect that combined with a GUI this would be excellent (and I know I asked for a commandline solution but I'd take that). But as it is that's quite hard to actually work with to work out where the differences are to fix them.
(Background: Some time ago I wrote some scripts to generate dozens of XML configuration files for a wide range of devices. The target software has now been updated and the configuration file structure has changed. Performing the software upgrade also upgraded all the XML config files, but I need to adapt my scripts to reliably generate files in the new format. So I need to find the differences between what I generate and what the upgraded files look like. A lot of the changes are minimal, like the upgraded files have had all comments stripped out, but also they've shuffled the order of various bits around in ways which are entirely cosmetic but which I can't easily replicate without major changes to my script.)