| User's Guide for Xhsc | ||
|---|---|---|
| <<< Previous | Next >>> | |
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.
-q
Quiet - with this option, Xhsc will print no messages during startup or processing.
-v
Verbose - with this option, Xhsc will print progress messages and possibly warnings during startup or processing. This is the default behavior.
-i
Indent - with this option, Xhsc will instruct the XML output processor to indent the output. How well this actually works can vary amoung XSLT implementations.
-n
No Indent - with this option, Xhsc will instruct the XML output processor not to bother indenting the output. This is the default.
-a
ASCII output - with this option, Xhsc will instruct the XML output processor to use ASCII encoding (7-bit) for generating the output document.
-u
UTF-8 output - with this option, Xhsc will instruct the XML output processor to use UTF-8 encoding for generating the output document. This is the default.
-8
ISO8859 output - with this option, Xhsc will instruct the XML output processor to use 8-bit ISO 8859-1 encoding for generating the output document.
-F
Fragment - with this option, Xhsc's output document will not includes a mandatory <?xml version="1.0"?> line at the beginning. Use this only if your output is intended to be incorporated into a larger XML document, perhaps as an external entity.
-x
XML Input - with this option, Xhsc will attempt to read its input document as XML. This is the default.
-t
Text Input - with this option, Xhsc will attempt to read its input document as line-by-line text. It will then construct an internal XML document consisting almost entirely of Text nodes, and attempt to apply the transform algorithm to that. When using this option, it is likely that your transform specification will make heavy use of the Xhsc tag match attribute.
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 $ |
| <<< Previous | Home | Next >>> |
| Building Xhsc Specifications | Using Xhsc in a Java XML Program |