Is there any formal way or known way to canonicalize an XML file to generate differences?

There seems to be a lot of questions A WRT tool for creating differences between xmls, but no question has been asked yet, so anyone who knows this will show me a link or paste any example that already solved this problem.

Canonicalizing an xml file means

  • reordering attributes
  • reordering the appearance of tags (selected using the command line option)
  • end of insert line (CR / CR + LF / LF) if there is no close tag at the end
  • insertion insertion tab (space)
  • remove excess spaces and line endings

And then you can clear the xml files to see which part has been updated.

I want to use this procedure for canonicalization in a unix environment, as soon as possible, before checking in the version control repository.

+4
source share
2 answers

XMLStarlet has canonicalization mode ( c14n ).

+1
source

All Articles