Make an XML document canonical, removing comments

xml canonic

xml canonic --without-comments {{path/to/input.xml|URI}} > {{path/to/output.xml}}

click the source code to copy install xml canonic on any operating system with command-not-found.com