using catalog file with saxon9he

1k views Asked by At

I'd like to use a catalog file to make Saxon shut up about not finding DTDs. Currently, I use dummy DTDS and emulate the required folder structure, but that's not ideal.

However, when I run the transformation, I get the following error:

Transformation failed: Failed to load Apache catalog resolver library

Here's how I call Saxon from Altova:

java -jar "F:\saxon9he.jar" -s:%1 -o:%2 -xsl:%3 -t -catalog:"catalog.xml"

I downloaded the xerces parser and took the resolver.jar from there. Is that already a mistake? (It said so here: http://www.sagehill.net/docbookxsl/UseCatalog.html)

The saxon9he.jar, the resolver.jar and the catalog.xml are all in the same folder.

Here's the catalog.xml:

<?xml version="1.0"?>
<catalog  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> 
    <public 
       publicId="-//EG//DTD EG DITA Map//EN" 
       uri="dtds/maps.dtd"/>
    <public 
       publicId="-//EG//DTD EG DITA Composite//EN" 
       uri="dtds/topics.dtd"/>
</catalog>

Here's how the DTDs look in the files:

<!DOCTYPE doc_map PUBLIC "-//EG//DTD EG DITA Map//EN" "../../system/dtd/client/eg-docmap.dtd">

<!DOCTYPE concept PUBLIC "-//EG//DTD EG DITA Composite//EN" "../../system/dtd/client/eg-dita.dtd">

I created the folder dtd which contains maps.dtd and topics.dtd (both files are empty).

I looked at this post: How to use saxon built-in catalog feature but wasn't able to get a solution form that.

Is this still a bug or something? Or did I do something wrong?

EDIT:

Console output:

Loading catalog: \catalog.xml
Saxon-HE 9.6.0.4J from Saxonica
Java version 1.7.0_09
Stylesheet compilation time: 940.807978ms
Processing file:/F:/export/folders.xml
Using parser org.apache.xml.resolver.tools.ResolvingXMLReader
Building tree for file:/F:/export/folders.xml using class
net.sf.saxon.tree.tiny.TinyBuilder
Tree built in 3.841258ms
Tree size: 6 nodes, 0 characters, 6 attributes
Building tree for file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map using class net.sf.saxon.tree.tiny.TinyBuilder
Error at template on line 33 of maps.xsl:
  I/O error reported by XML parser processing
  file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map: F:\export\system\dtd\client\map.dtd (cannot find path)
I/O error reported by XML parser processing file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.ditamap: F:\export\system\dtd\client\
map.dtd (cannot find path)
1

There are 1 answers

8
Michael Kay On BEST ANSWER

Don't use the -jar option if you want to load software from more than one JAR file. Use the -cp option to define the classpath containing all the required JARs, and specify your desired entry point (net.sf.saxon.Transform) explicitly.