Add
to your assembly_install_dir/lib/assembly.jarCLASSPATH.
Optionally, if your assembly loads XML documents having a DTD
(e.g. transform DITA topics to DocBook topics), also
add
to your assembly_install_dir/lib/resolver.jarCLASSPATH. File resolver.jar
contains Apache XML
Commons Resolver which implements catalog-based entity and URI
resolution.
Create an instance of Processor:
Processor processor = new Processor();
Do not share this instance between different threads, as this class is not thread-safe.
If you don't want the error, warning and progress messages to be
displayed on System.err and to
System.out, implement interface Console and
pass an instance of your implementation to the constructor.
Parameterize the processor by invoking either configure(String[]) or individual configuration methods such as setProcessedStructId(String), setOutputFormat(String), etc. Example:
int l = -1;
try {
l = processor.configure(args);
} catch (IllegalArgumentException e) {
// FATAL ERROR. DO SOMETHING HERE.
}
// PARSE THE REMAINING ARGUMENTS, IF ANY,
// STARTING AT INDEX l.Finally invoke method process(URL, File). Pass this method the input assembly URL and the output realized document save file.
try {
if (!processor.process(inURL, outFile)) {
// FATAL ERROR. DO SOMETHING HERE.
// ERRORS HAVE BEEN DISPLAYED ON THE Console.
}
} catch (IOException e)
// FATAL ERROR. DO SOMETHING HERE.
}