Linux command
xml-canonic 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Canonicalize XML (W3C C14N)
xml canonic [file.xml]
Exclusive canonicalization
xml canonic --exc-c14n [file.xml]
Canonicalize without comments
xml canonic --without-comments [file.xml]
Read from stdin
cat file.xml | xml canonic
说明
xml canonic produces a canonical XML form of the input document as defined by the W3C XML Canonicalization (C14N) specification. Canonicalization normalizes whitespace, attribute order, namespace declarations, and character encoding so that two logically equivalent documents produce identical byte streams. It is part of the xmlstarlet command-line XML toolkit. Canonical XML is commonly used as a preparation step before computing cryptographic digests for XML digital signatures (XML-DSig), and for reliable document comparison.
参数
- --exc-c14n
- Use Exclusive XML Canonicalization (EXC-C14N) instead of the default Canonical XML 1.0.
- --without-comments
- Omit comments from canonical output.
FAQ
What is the xml-canonic command used for?
xml canonic produces a canonical XML form of the input document as defined by the W3C XML Canonicalization (C14N) specification. Canonicalization normalizes whitespace, attribute order, namespace declarations, and character encoding so that two logically equivalent documents produce identical byte streams. It is part of the xmlstarlet command-line XML toolkit. Canonical XML is commonly used as a preparation step before computing cryptographic digests for XML digital signatures (XML-DSig), and for reliable document comparison.
How do I run a basic xml-canonic example?
Run `xml canonic [file.xml]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --exc-c14n do in xml-canonic?
Use Exclusive XML Canonicalization (EXC-C14N) instead of the default Canonical XML 1.0.