Shoobx / xmldiff

A library and command line utility for diffing xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A flag to ignore order

regebro opened this issue · comments

Some XML formats don't care about the order of the nodes in a subnode. A flag to skip reordering in one node might be useful for some formats. Comment here if you need this (because if no one actually need it, it won't happen).

I ran across this problem in a project of mine, where I was comparing musical scores with xmldiff. I didn't care about the order of layers within a bar, for example, but did care about the order of bars within a piece and the order of notes and rests within a bar.

I ended up using xmldiff anyway, however the output of the comparison would be much cleaner with the ability to ignore order for certain node types.

Is this an active request at the moment ? Commenting here because we need it and encountered many scenarios where ordering is not important and xmldiff unnecessarily move around the child nodes.

If you mean if somebody is actively working on it, to my knowledge no. I'm also not entirely convinced it should be a feature. xmldiff shows you the difference. If there are differences you don't care about, that's to some extent up to you.

Another option might be having a command to "sort" the XML files before the diffing. But that could potentially have other issues.

It's also notable that you ask about attributes, and Alex above asked for nodes, but only certain type of nodes. If we support this in xmldiff it would likely just to ignore ordering full stop.

It's also important to know that this would make the output unusable to patch things, so it's only relevant for formatters intended to be used by humans, but NOT when using formats intended for humans, as then the order WOULD be important. So it's a rather narrow usecase.