Apache FOP: Resolve to local docbook installation

568 Views Asked by At

I need to configure Apache FOP so that it uses my local docbook dtd files etc. I tried pretty much everything from writing a catalog file to installing apache xml resolver etc

Here is the catalog file I wrote. I also set the xml.catalog.files property to this file and instantiated an apache catalog resolver that the FopFactory uses as URIResolver. But the fop still fetches everything from the net.

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group  prefer="public"  xml:base="file:///Users/raichoo/">
  <public publicId="-//OASIS//DTD DocBook XML V4.5//EN" uri="docbook/docbookx.dtd" />
  <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" uri="docbook/docbookx.dtd" />
  <system systemId="http://www.oasis-open.org/docbook/xml/4.5/" uri="docbook/" />
  <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.5/" rewritePrefix="docbook/"/>
</group>                                                                                                                      

</catalog>

Any ideas what's going wrong?

Regards, raichoo

3

There are 3 best solutions below

0
On BEST ANSWER

I solved the problem by simply removing the DOCTYPE from the file to transform. Not exactly a pretty solution but I could not convince to FOP to resolve the URIs.

Regards, raichoo

1
On

I think the problem is the DOCTYPE declaration in your catalog file:

  1. The syntax is wrong: it ends with /> instead of > and a closing quotation mark is missing.

  2. With item 1 fixed, the resolver tries to fetch the DTD from http://www.oasis-open.org/committees/entity. There is no DTD at that location, and the resolver gives up.

I did some tests, and when I simply removed the whole <!DOCTYPE ..> line from the catalog file, things started working as expected.

0
On

I use this doctype element definition in my catalog.xml file:

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
 ...
</catalog>