This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE: XML catalog resolution problems


I had some further correspondence with Norm about
this problem.  It turns out that relative system ids
can't be resolved by the Java resolver classes because
they never even see them in their original form.

He explained that the SAX API resolves a relative system id
such as "docbookx.dtd" as relative to the document's
directory.  The SAX API changed "docbookx.dtd" to
"file:/c:/XMLtest/catalogs/test/Saxon/docbookx.dtd"
in the parsing stage.  That's why the resolver reports:

resolveSystem(file:/c:/XMLtest/catalogs/test/Saxon/docbookx.dtd)

instead of:

resolveSystem(docbookx.dtd)

He says there is no hook for the resolver classes to get
the original "docbookx.dtd" string for the resolver to
look up in the catalog.  He says he argued against this
behavior at the time, but lost.

I tried "faking" an absolute path, with a system id such as
"/docbookx.dtd".  But I found that my XML catalog needed
to have three catalog entries with three different systemIds
if I wanted to use different processors:

systemId="/docbookx.dtd"           (xsltproc)
systemId="file:/docbookx.dtd"      (saxon)
systemId="file:///docbookx.dtd"    (xalan)

Ugh!  Better to use a fake URI such as "http://docbookx.dtd";
in your files and catalog since that shouldn't be messed with
by the parsers.


Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com


On Fri, Nov 08, 2002 at 02:59:40PM +0100, Jeanson Mauritz wrote:
> > -----Original Message-----
> > From: Norman Walsh [mailto:ndw@nwalsh.com]
> > Sent: Friday, October 25, 2002 7:06 PM
> > To: Jeanson Mauritz
> > Cc: docbook-apps@lists.oasis-open.org
> > Subject: Re: XML catalog resolution problems
> > 
> > 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > / Jeanson Mauritz <mauritz.jeanson@aerotechtelub.se> was heard to say:
> > | This is the current score:
> > |
> > | A. Resolution of system IDs: does not work at all.
> > |
> > | B. Resolution of stylesheet locations: works only if I
> > |  1. use Saxon's -u flag,
> > |  2. use <uri> instead of <system> in the catalog file,
> > |  3. prepend the xml file name with "file:" on the command line, and
> > |  4. use a system ID with full path to the DTD (or a public ID).
> > 
> > That's very odd. Try turning up the "verbosity" of the resolver. A
> > setting of 4 or more should produce a complete dump of everything it
> > tried to do.
> 
> 
> Here is a test of system IDs that fails. In this example I use the catalog 
> only for the DTD, and not for the stylesheet.
> 
> Doctype declaration in the XML file:
> 
> <!DOCTYPE article SYSTEM "docbookx.dtd">
> 
> Catalog file:
> 
> <catalog 
>   xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
>     <system 
>        systemId="docbookx.dtd"
>        uri="file:///c:/doctypes/docbook/xml/docbookx.dtd"/>
> <catalog>
> 
> Below is a complete dump from my attempt to resolve the system ID. 
> (I use Swedish Win2K: "Det ger inte att hitta filen" means 
> "the file cannot be found").
> 
> What goes wrong here?
> For some reason it works perfectly if I use a public ID instead, like this:
> 
> <!DOCTYPE article 
> PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "docbookx.dtd">
> 
> and
> 
> <catalog 
>   xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
> <public 
>    publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
>    uri="file:///c:/doctypes/docbook/xml/docbookx.dtd">
> <catalog>
> 
> 
> Regards,
> Mauritz J
> 
> 
> Dump for System ID resolution
> =============================
> C:/jdk1.3.1/bin/java -classpath \
> ".;c:/xmltest/catalogs/resolver-1.1/resolver.jar;c:/Java/saxon/saxon.jar" \
> com.icl.saxon.StyleSheet \
> -r org.apache.xml.resolver.tools.CatalogResolver \
> -x org.apache.xml.resolver.tools.ResolvingXMLReader \ 
> -y org.apache.xml.resolver.tools.ResolvingXMLReader \
> -o kprof.html kprof.xml c:/doctypes/docbook/xsl/html/docbook.xsl
> 
> Parse catalog: catalog.xml
> Loading catalog: catalog.xml
> Default BASE: file:/c:/XMLtest/catalogs/test/Saxon/catalog.xml
> system: docbookx.dtd
> 	file:///c:/doctypes/docbook/xml/docbookx.dtd
> SYSTEM: docbookx.dtd
> 	file:/c:/doctypes/docbook/xml/docbookx.dtd
> resolveURI(../VERSION)
> Resolved URI: ../VERSION
> 	file:/c:/doctypes/docbook/xsl/VERSION
> resolveURI(param.xsl)
> Resolved URI: param.xsl
> 	file:/c:/doctypes/docbook/xsl/html/param.xsl
> resolveURI(../lib/lib.xsl)
> Resolved URI: ../lib/lib.xsl
> 	file:/c:/doctypes/docbook/xsl/lib/lib.xsl
> resolveURI(../common/l10n.xsl)
> Resolved URI: ../common/l10n.xsl
> 	file:/c:/doctypes/docbook/xsl/common/l10n.xsl
> resolveURI(../common/common.xsl)
> Resolved URI: ../common/common.xsl
> 	file:/c:/doctypes/docbook/xsl/common/common.xsl
> resolveURI(../common/labels.xsl)
> Resolved URI: ../common/labels.xsl
> 	file:/c:/doctypes/docbook/xsl/common/labels.xsl
> resolveURI(../common/titles.xsl)
> Resolved URI: ../common/titles.xsl
> 	file:/c:/doctypes/docbook/xsl/common/titles.xsl
> resolveURI(../common/subtitles.xsl)
> Resolved URI: ../common/subtitles.xsl
> 	file:/c:/doctypes/docbook/xsl/common/subtitles.xsl
> resolveURI(../common/gentext.xsl)
> Resolved URI: ../common/gentext.xsl
> 	file:/c:/doctypes/docbook/xsl/common/gentext.xsl
> resolveURI(../common/targets.xsl)
> Resolved URI: ../common/targets.xsl
> 	file:/c:/doctypes/docbook/xsl/common/targets.xsl
> resolveURI(autotoc.xsl)
> Resolved URI: autotoc.xsl
> 	file:/c:/doctypes/docbook/xsl/html/autotoc.xsl
> resolveURI(autoidx.xsl)
> Resolved URI: autoidx.xsl
> 	file:/c:/doctypes/docbook/xsl/html/autoidx.xsl
> resolveURI(lists.xsl)
> Resolved URI: lists.xsl
> 	file:/c:/doctypes/docbook/xsl/html/lists.xsl
> resolveURI(callout.xsl)
> Resolved URI: callout.xsl
> 	file:/c:/doctypes/docbook/xsl/html/callout.xsl
> resolveURI(verbatim.xsl)
> Resolved URI: verbatim.xsl
> 	file:/c:/doctypes/docbook/xsl/html/verbatim.xsl
> resolveURI(graphics.xsl)
> Resolved URI: graphics.xsl
> 	file:/c:/doctypes/docbook/xsl/html/graphics.xsl
> resolveURI(xref.xsl)
> Resolved URI: xref.xsl
> 	file:/c:/doctypes/docbook/xsl/html/xref.xsl
> resolveURI(formal.xsl)
> Resolved URI: formal.xsl
> 	file:/c:/doctypes/docbook/xsl/html/formal.xsl
> resolveURI(table.xsl)
> Resolved URI: table.xsl
> 	file:/c:/doctypes/docbook/xsl/html/table.xsl
> resolveURI(../common/table.xsl)
> Resolved URI: ../common/table.xsl
> 	file:/c:/doctypes/docbook/xsl/common/table.xsl
> resolveURI(sections.xsl)
> Resolved URI: sections.xsl
> 	file:/c:/doctypes/docbook/xsl/html/sections.xsl
> resolveURI(inline.xsl)
> Resolved URI: inline.xsl
> 	file:/c:/doctypes/docbook/xsl/html/inline.xsl
> resolveURI(footnote.xsl)
> Resolved URI: footnote.xsl
> 	file:/c:/doctypes/docbook/xsl/html/footnote.xsl
> resolveURI(html.xsl)
> Resolved URI: html.xsl
> 	file:/c:/doctypes/docbook/xsl/html/html.xsl
> resolveURI(info.xsl)
> Resolved URI: info.xsl
> 	file:/c:/doctypes/docbook/xsl/html/info.xsl
> resolveURI(keywords.xsl)
> Resolved URI: keywords.xsl
> 	file:/c:/doctypes/docbook/xsl/html/keywords.xsl
> resolveURI(division.xsl)
> Resolved URI: division.xsl
> 	file:/c:/doctypes/docbook/xsl/html/division.xsl
> resolveURI(toc.xsl)
> Resolved URI: toc.xsl
> 	file:/c:/doctypes/docbook/xsl/html/toc.xsl
> resolveURI(index.xsl)
> Resolved URI: index.xsl
> 	file:/c:/doctypes/docbook/xsl/html/index.xsl
> resolveURI(refentry.xsl)
> Resolved URI: refentry.xsl
> 	file:/c:/doctypes/docbook/xsl/html/refentry.xsl
> resolveURI(math.xsl)
> Resolved URI: math.xsl
> 	file:/c:/doctypes/docbook/xsl/html/math.xsl
> resolveURI(admon.xsl)
> Resolved URI: admon.xsl
> 	file:/c:/doctypes/docbook/xsl/html/admon.xsl
> resolveURI(component.xsl)
> Resolved URI: component.xsl
> 	file:/c:/doctypes/docbook/xsl/html/component.xsl
> resolveURI(biblio.xsl)
> Resolved URI: biblio.xsl
> 	file:/c:/doctypes/docbook/xsl/html/biblio.xsl
> resolveURI(glossary.xsl)
> Resolved URI: glossary.xsl
> 	file:/c:/doctypes/docbook/xsl/html/glossary.xsl
> resolveURI(block.xsl)
> Resolved URI: block.xsl
> 	file:/c:/doctypes/docbook/xsl/html/block.xsl
> resolveURI(qandaset.xsl)
> Resolved URI: qandaset.xsl
> 	file:/c:/doctypes/docbook/xsl/html/qandaset.xsl
> resolveURI(synop.xsl)
> Resolved URI: synop.xsl
> 	file:/c:/doctypes/docbook/xsl/html/synop.xsl
> resolveURI(titlepage.xsl)
> Resolved URI: titlepage.xsl
> 	file:/c:/doctypes/docbook/xsl/html/titlepage.xsl
> resolveURI(titlepage.templates.xsl)
> Resolved URI: titlepage.templates.xsl
> 	file:/c:/doctypes/docbook/xsl/html/titlepage.templates.xsl
> resolveURI(pi.xsl)
> Resolved URI: pi.xsl
> 	file:/c:/doctypes/docbook/xsl/html/pi.xsl
> resolveURI(ebnf.xsl)
> Resolved URI: ebnf.xsl
> 	file:/c:/doctypes/docbook/xsl/html/ebnf.xsl
> resolveURI(chunker.xsl)
> Resolved URI: chunker.xsl
> 	file:/c:/doctypes/docbook/xsl/html/chunker.xsl
> resolveURI(html-rtf.xsl)
> Resolved URI: html-rtf.xsl
> 	file:/c:/doctypes/docbook/xsl/html/html-rtf.xsl
> resolveSystem(file:/c:/XMLtest/catalogs/test/Saxon/kprof.xml)
> resolveSystem(file:/c:/XMLtest/catalogs/test/Saxon/docbookx.dtd)
> Error on line 3 column 39 of file:/c:/XMLtest/catalogs/test/Saxon/kprof.xml:
>   Error reported by XML parser: Cannot read from \
> file:/c:/XMLtest/catalogs/test/Saxon/docbookx.dtd \
> (c:\XMLtest\catalogs\test\Saxon\docbookx.dtd (Det ger inte att hitta filen))
> Transformation failed: Run-time errors were reported

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]