Command-line syntax and examples | Syntax | Examples | Reading input from a file | Passing a quoted string as input | Contact us
To open a command-line console see Open a command-line console in a given directory.
> sc14n --help
Usage: sc14n [OPTION]... [INFILE]
Performs the C14N transformation of a straightforward XML document.
-o, --output=OUTFILE output to OUTFILE [default=stdout]
-i, --input=INFILE input from INFILE (optional option)
-x, --exclude-bytag=TAGNAME omit (exclude) element with name TAGNAME
-s, --subset-bytag=TAGNAME make subset for element with name TAGNAME
To specify the N'th element write as `TAGNAME[N]` for N=1,2,3,...
-X, --exclude-byid=IDVALUE omit (exclude) element with Id="IDVALUE"
-S, --subset-byid=IDVALUE make subset for element with Id="IDVALUE"
For an IDNAME other than `Id` write as `IDNAME=IDVALUE` (no quotes)
-c, --with-comments include comments (#WithComments)
-e, --exclusive use exclusive c14n [default=inclusive]
-p, --prefix-list="LIST" space-separated list of namespace prefixes
to be handled as per inclusive c14n (exclusive c14n only)
-d, --digest-value output base64-encoded digest value, not XML
-2, --sha256 use SHA-256 algorithm with -d [default=SHA-1]
-3, --sha384 use SHA-384 algorithm with -d [default=SHA-1]
-5, --sha512 use SHA-512 algorithm with -d [default=SHA-1]
-f, --flatten flatten XML-remove all whitespace between tags
-k, --check check input is valid XML
-@, --stdin read input from stdin [default=INFILE]
-v, --version print program version and exit
-L, --libinfo print details of core library and exit
-h, --help print this help and exit
-E, --examples print examples and exit
The options `-x|-X|-s|-S` are mutually exclusive.
INFILE must be specified unless `--stdin` option is used.
INFILE may be a quoted XML string "<a><b/></a>" instead of a filename.
By default the entire input XML document is transformed and output to stdout.
Exit status is 0 on success, 1 if error, or 2 if no matching data found.
For examples type `sc14n --examples`
sc14n --prefix-list="wsse SOAP-ENV" ... OK sc14n --prefix-list "wsse SOAP-ENV" ... was ERROR now OK sc14n -p "wsse SOAP-ENV" ... OK
> sc14n --examples Examples: sc14n -o out.txt file.xml computes C14N transformation of entire XML document `file.xml` and writes result to file `out.txt`. sc14n -x "ds:Signature" file.xml computes C14N transformation of XML document EXCLUDING the first element with tag name `ds:Signature`. sc14n -s "ds:SignedInfo" file.xml computes C14N transformation of subset with tag name `ds:SignedInfo`. sc14n -S "ref123" file.xml computes C14N transformation of subset with Id="ref123". sc14n -S "myId=ref456" file.xml computes C14N transformation of subset with myId="ref456". sc14n -s "elemName[3]" file.xml computes C14N transformation of subset for the 3rd element found with tag name `elemName`. sc14n -d file.xml computes C14N transformation of entire XML document `file.xml` and outputs resulting digest value using default SHA-1 algorithm. sc14n -d --sha256 file.xml computes C14N transformation of entire XML document `file.xml` and outputs resulting digest value using SHA-256 algorithm. sc14n "<a><b/></a>" accepts XML data as a quoted string. In this case the output is <a><b></b></a>
Three ways to read input from a file.
1. Pass the filename directly using the INFILE parameter.sc14n file.xml2. Read from stdin using "<" redirection operator.
sc14n -@ < file.xml3. Use a pipe
type file.xml | sc14n -@
sc14n "<doc/>" <doc></doc>Can we use a pipe?
echo "<doc/>"| sc14n -@ Error code -9: Invalid XML structure: Error: Invalid at the top level of the document (Line: 1)Ah, no. The echo command passes the quote characters literally and the resulting input to Sc14n is invalid XML.
OK, try using echo without the quotes
echo <doc/>| sc14n -@ | was unexpected at this time.The "<" and ">" characters used for XML tags have a different meaning on the command line and Windows does not accept this.
The correct way: use set /p with quotes.
echo | set /p="<doc/>"| sc14n -@ <doc></doc>This time it works.
To contact us or comment on this page, please send us a message.
This page last updated 10 September 2025