Using Xhsc from the Command Line

Xhsc can be used as a Java application. The command line syntax for it is very simple:

java -jar hsc.jar [options] input-file specification-file output-file

If you have installed the Xhsc jar file, hsc.jar, on your CLASSPATH or in your JRE's extension area, then you can use the simpler command syntax java HSC.

If the input-file is given as "-", then the standard input is used for the input document. If the output-file is given as "-", then the output document will be written to the standard output.

Xhsc supports the following options. They may appear in any order, or may be grouped together.

Here is an example of a very simple Xhsc command line, being run in a Windows command box. The output from this command will be indented.

Example 10. A Simple Xhsc Command


D:\xml> java -jar hsc.jar -i inv1.xhtml conv-inv.hsc inv-2.xml
HSC: XML Hierarchical Structure Creator, version 1.3, by nziring - 1/10/02
HSC: Input file is inv1.xhtml
HSC: Transform file is conv-inv.hsc
HSC: Output file: inv-2.xml
HSC: Reading input file.
HSC: Reading transform file.
HSC: Processing transform file to extract HSC directives
HSC: Got 18 HSC directives
HSC: Applying HSC directives to generate structure.
HSC: About to apply transform and generate output.
HSC: Finished.
HSC: processing return code: 0
D:\xml> 

Here is another example, this one uses Xhsc as the end of a Linux shell pipeline, encodes the output in ASCII, and does not use indenting. Note that the messages are printed to the standard error output; we could suppress the messages using the -q option.

Example 11. Using an Xhsc Command in a Pipe


$ gunzip -c tmp-3.xml.gz | java -jar hsc.jar -anv - html-hsc.xml tmp-4.xml
HSC: XML Hierarchical Structure Creator, version 1.3, by nziring - 1/10/01
HSC: Input file is -
HSC: Transform file is html-hsc.xml
HSC: Output file: tmp-4.xml
HSC: Reading input file.
HSC: Reading transform file.
HSC: Processing transform file to extract HSC directives
HSC: Got 29 HSC directives
HSC: Applying HSC directives to generate structure.
HSC: html-hsc.xml is not an XSLT stylesheet, creating identity stylesheet for output.
HSC: About to apply transform and generate output.
HSC: Finished.
HSC: processing return code: 0
$