xml-c14n
Canonicalize XML documents (xmlstarlet c14n)
TLDR
SYNOPSIS
xml c14n mode xml-file [xpath-file] [inclusive-ns-list]
DESCRIPTION
xml c14n is the canonicalization sub-command of xmlstarlet. It produces a byte-stable serialization of an XML document according to the W3C Canonical XML 1.0 or Exclusive XML Canonicalization 1.0 specifications. The result is what tools must compute before generating or verifying XML Digital Signatures (XML-DSig) so that semantically equivalent documents hash to the same value.Inclusive canonicalization includes ancestor namespace declarations; exclusive canonicalization (used by SAML, WS-Security, etc.) drops them unless explicitly listed in the inclusive namespace prefix list.
PARAMETERS
MODE (required, exactly one)
One of --with-comments, --without-comments, --exc-with-comments, --exc-without-comments.XML-FILE
XML document to canonicalize. Use - to read stdin.XPATH-FILE
Optional XML file whose root element's text content is an XPath expression that selects the node-set to canonicalize.INCLUSIVE-NS-LIST
For exclusive C14N only: space-separated list of namespace prefixes to treat as inclusive (e.g. `'soap xsd'`).
INSTALL
CAVEATS
The mode flag is positional — every invocation must supply exactly one of the four mode options before the input file. The XPath argument is itself an XML file containing an XPath, not a literal expression on the command line.
SEE ALSO
xmlstarlet(1), xml-canonic(1), xml-format(1), xmllint(1)
