Re: [docbook-apps] Problem with XML catalogs and Saxon

From
Zbyszek Cybulski <>
Date
2006-01-18T20:32:59+00:00
ID
Thread
Re: [docbook-apps] Problem with XML catalogs and Saxon
Hello,

thank you, sir.
I was struggling to solve the problem using all the suggestions I have found in the Internet. You are absolutely right, you never used that kind of syntax to set the "catalogs" parameter.

I am a bit confused after reading documentation for the Apache XML catalog resolver. Hence, you can see this chaotic attempt to find a solution. I will try your suggestions ASAP and will come back with the results, if I am successful.

Thanks again,

-Zbyszek

On 1/18/06, Bob Stayton <> wrote:

Hi,

Your catalog.xml file is not being loaded 
because of the syntax you used in CatalogManager.properties:

 

  
catalogs=file://catalog.xml

 

I don't think my book ever uses such syntax 
for a relative path.  If it does, please show me where so I can fix 
it.  When I use that syntax in my CatalogManager.properties, my version of 
Java responds with the following first line of error:

 

  java.net.UnknownHostException: 
catalog.xml

 

It thinks file://catalog.xml is a network address.  Try 
using this instead:

 

  catalogs=catalog.xml

 

Also, you don't want to set 
relative-catalogs=true because then relative paths in "catalogs=" are taken as 
relative to the XML document location.  When that property is false, then 
relative paths to catalog files are taken as relative to the 
CatalogManager.properties file, which is what I think you want.

 

 

Bob Stayton
Sagehill Enterprises
DocBook Consulting


 

 

  
----- Original Message ----- 

  

From: 
  Zbyszek 
  Cybulski 

  
To: 
DocBook Apps 

  
Sent: Wednesday, January 18, 2006 12:03 
  AM

  
Subject: [docbook-apps] Problem with XML 
  catalogs and Saxon

  

Hi all,

I am trying to set up the toolchain according to 
  the directions from http://sagehill.net/docbookxsl/Catalogs.html 
I have 
  completed all the procedures described in the book. 
Unfortunately, I can't 
  set the toolchain to use local files (DTD and XSL).

Here is my 
  directory tree:
c:\public
+---catalog [contains catalog.xml and 
  properties for the catalog resolver]
+---docbook
|   +---dtd 
  [equiv. to dtd44]
|   |   \---ent
|   
  +---dtd44
|   |   \---ent
|   \---xsl 
  [current XSL distro]
[zap: full DocBook XSL distro goes here] 
\---docs 
  [directory with many subdirectories with source 
  files]

Catalog.properties:
---------------------------
catalogs=file://catalog.xml;file:///c:/public/docbook/dtd/docbook.cat 
  
relative-catalogs=true
static-catalog=yes
catalog-class-name=org.apache.xml.resolver.Resolver
verbosity=4
prefer=public

catalog.xml:
------------------
<?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">

  <!-- 
  DTD and stylesheet files installed under c:\public\ -->
  <group 
  prefer="public" xml:base=" file:///c:/public/" > 
    
  <public 
         
  publicId="-//OASIS//DTD DocBook XML 
  V4.4//EN"
         
  uri="docbook/dtd/docbookx.dtd"/>
    
  
    <!-- Resolve DTD URL system ID to local file --> 
  
    
  <rewriteSystem
        
  systemIdStartString="http://www.oasis-open.org/docbook/xml/4.4/"
        
  rewritePrefix=" file://docbook/dtd/" 
  />

        <!-- Resolve stylesheet 
  URL to local file -->
    
  <rewriteURI
        
  uriStartString="http://docbook.sourceforge.net/release/xsl/current/ 
  "
        rewritePrefix="file:///docbook/xsl/" 
  />
    
    <!-- Resolve DTD PUBLIC 
  identifiers -->
    <nextCatalog  catalog=" file://docbook/dtd/catalog.xml" 
  />

  </group>

</catalog>

All 
  environment variables are set.

I call the HTML transformation from 
  c:\public\catalog and get the following results: 

$ java 
  com.icl.saxon.StyleSheet -x org.apache.xml.resolver.tools.ResolvingXMLReader 
  -y org.apache.xml.resolver.tools.ResolvingXMLReader -r 
  org.apache.xml.resolver.tools.CatalogResolver -u -o ../docs/sample.html 
  file://../docs/sample.xml http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl

Parse 
  catalog: file:///c:/public/docbook/dtd/docbook.cat 
  
Loading catalog: file://catalog.xml
Default BASE: file://catalog.xml
java.net.ConnectException: 
  Connection refused: connect
        at 
  java.net.PlainSocketImpl.socketConnect (Native 
  Method)
        at 
  java.net.PlainSocketImpl.doConnect(Unknown 
  Source)
        at 
  java.net.PlainSocketImpl.connectToAddress(Unknown 
  Source)
        at 
  java.net.PlainSocketImpl.connect(Unknown 
  Source)
        at 
  java.net.Socket.connect(Unknown 
  Source)
        at 
  java.net.Socket.connect(Unknown 
  Source)
        at 
  sun.net.NetworkClient.doConnect(Unknown 
  Source)
        at 
  sun.net.NetworkClient.openServer(Unknown 
  Source)
        at 
  sun.net.ftp.FtpClient.openServer(Unknown 
  Source)
        at 
  sun.net.ftp.FtpClient.openServer(Unknown 
  Source)
        at 
  sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown 
  Source)
        at 
  sun.net.www.protocol.ftp.FtpURLConnection.getInputStream (Unknown 
  Source)
        at 
  java.net.URL.openStream(Unknown 
  Source)
        at 
  org.apache.xml.resolver.Catalog.parseCatalogFile(Unknown 
  Source)
        at 
  org.apache.xml.resolver.Catalog.parsePendingCatalogs(Unknown Source) 
  
        at 
  org.apache.xml.resolver.Catalog.parseCatalog(Unknown 
  Source)
        at 
  org.apache.xml.resolver.Catalog.loadSystemCatalogs(Unknown 
  Source)
        at 
  org.apache.xml.resolver.tools.CatalogResolver.initializeCatalogs (Unknown 
  Source)
        at 
  org.apache.xml.resolver.tools.CatalogResolver.<init>(Unknown 
  Source)
        at 
  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
  Method)
        at 
  sun.reflect.NativeConstructorAccessorImpl.newInstance (Unknown 
  Source)
        at 
  sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown 
  Source)
        at 
  java.lang.reflect.Constructor.newInstance(Unknown 
  Source)
        at 
  java.lang.Class.newInstance0(Unknown Source) 
  
        at 
  java.lang.Class.newInstance(Unknown 
  Source)
        at 
  com.icl.saxon.Loader.getInstance(Loader.java:91)
        
  at 
  com.icl.saxon.StyleSheet.makeURIResolver(StyleSheet.java:551)
        
  at com.icl.saxon.StyleSheet.doMain 
  (StyleSheet.java:164)
        at 
  com.icl.saxon.StyleSheet.main(StyleSheet.java:47)
resolveURI(file://../docs/sample.xml)
Resolved 
  URI: file://../docs/sample.xml
        
  file://../docs/sample.xml
resolveURI( http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
)
Resolved 
  URI: http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl

        
  http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl 
  
resolveSystem(http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
)
Transformation 
  failed: java.io.EOFException: no more input 

Could anybody help me with 
  this? I know that many of you use XML catalogs, XIncludes etc. with success. 
  Network restrictions in my company prevent access to the Internet, except for 
  web browsers, so I have to use local files. 

One thing, which makes me 
  think, is that the example of the catalog.xml from Bob's book has parts that 
  do not work with Saxon (or other Java-based processor). The book does not 
  provide any solution that WORKS with Java-based processor.
I have searched 
  throughout the archives of this list and haven't found the solution of my 
  problem. 

Thanks in 
advance,

Zbyszek