You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xml-commons-dev@xerces.apache.org by Andy Hatton <an...@tarantella.com> on 2004/02/16 12:51:36 UTC

Support for processing instructions

Hi

I have been unable to find any explicit reference to whether the xml catalog
resolver supports the use of <?oasis-xml-catalog?> processing instructions.
Although I have assumed that they are supported, because of the
allow-oasis-xml-catalog-pi property in CatalogManager.properties.

Can anyone tell me whether they are supported and whether it works?

Whenever I use a processing instruction to identify a catalog, the
resolution of the dtd location always fails.

For example, if I use the following CatalogManager.properties:

catalogs=C:///temp/catalog/catalog1.xml
relative-catalogs=no
verbosity=99
prefer=public
static-catalog=no
allow-oasis-xml-catalog-pi=yes

and run the following command:

java org.apache.xalan.xslt.Process
-ENTITYRESOLVER org.apache.xml.resolver.tools.CatalogResolver
-URIRESOLVER org.apache.xml.resolver.tools.CatalogResolver
-IN "C:\temp\foo.xml"
-XSL "C:\temp\foobar.xslt"
-OUT "C:\temp\foo.html"

(foo.xml contains the following declaration <!DOCTYPE foo PUBLIC
"-//TTA//DTD FOO 1.0//EN" "foo.dtd">)

The output from the catalog resolver indicates that the location of the dtd
has been resolved correctly:

Parse catalog: C:///temp/catalog/catalog1.xml
Loading catalog: C:///temp/catalog/catalog1.xml
Default BASE: file:C:///temp/catalog/catalog1.xml
xml:base: file:///C:/temp/
BASE CUR: file:C:///temp/catalog/catalog1.xml
BASE STR: file:///C:/temp/
BASE NEW: file:/C:/temp/
override: yes
OVERRIDE: yes
public: -//TTA//DTD FOO 1.0//EN
        dtd/foo.dtd
PUBLIC: -//TTA//DTD FOO 1.0//EN
        file:/C:/temp/dtd/foo.dtd
public: -//TTA//ENTITIES Bar entities//EN
        entities/bar.ent
PUBLIC: -//TTA//ENTITIES Bar entities//EN
        file:/C:/temp/entities/bar.ent
(reset) xml:base: file:C:///temp/catalog/catalog1.xml
BASE CUR: file:/C:/temp/
BASE STR: file:C:///temp/catalog/catalog1.xml
BASE NEW: file:/C:/temp/C:///temp/catalog/catalog1.xml
Parse catalog: C:///temp/catalog/catalog1.xml
Loading catalog: C:///temp/catalog/catalog1.xml
Default BASE: file:C:///temp/catalog/catalog1.xml
xml:base: file:///C:/temp/
BASE CUR: file:C:///temp/catalog/catalog1.xml
BASE STR: file:///C:/temp/
BASE NEW: file:/C:/temp/
override: yes
OVERRIDE: yes
public: -//TTA//DTD FOO 1.0//EN
        dtd/foo.dtd
PUBLIC: -//TTA//DTD FOO 1.0//EN
        file:/C:/temp/dtd/foo.dtd
public: -//TTA//ENTITIES Bar entities//EN
        entities/bar.ent
PUBLIC: -//TTA//ENTITIES Bar entities//EN
        file:/C:/temp/entities/bar.ent
(reset) xml:base: file:C:///temp/catalog/catalog1.xml
BASE CUR: file:/C:/temp/
BASE STR: file:C:///temp/catalog/catalog1.xml
BASE NEW: file:/C:/temp/C:///temp/catalog/catalog1.xml
resolveSystem(file:///C:/temp/foo.dtd)
resolvePublic(-//TTA//DTD FOO 1.0//EN,file:///C:/temp/foo.dtd)
Resolved public: -//TTA//DTD FOO 1.0//EN
        file:/C:/temp/dtd/foo.dtd
resolveSystem(file:/C:/temp/dtd/bar.ent)
resolvePublic(-//TTA//ENTITIES Bar entities//EN,file:/C:/temp/dtd/bar.ent)
Resolved public: -//TTA//ENTITIES Bar entities//EN
        file:/C:/temp/entities/bar.ent


But when I try again using the following CatalogManager.properties:

catalogs=C:///temp/catalog/catalog2.xml
relative-catalogs=no
verbosity=99
prefer=public
static-catalog=no
allow-oasis-xml-catalog-pi=yes

(Catalog 2 is a valid catalog, but has no entries to resolve PUBLIC
"-//TTA//DTD FOO 1.0//EN" "foo.dtd")

foo1.xml contains an oasis-xml-catalog processing instruction to locate
catalog1.xml which can resolve the location of the dtd (see above).

I tried all of the following as PIs:

<?oasis-xml-catalog catalog="file:///C:/temp/catalog/catalog1.xml"?>

<?oasis-xml-catalog catalog="C:///temp/catalog/catalog1.xml"?>

<?oasis-xml-catalog catalog="catalog/catalog1.xml"?> (foo1.xml is in
C:\temp)


Run the following command:

java org.apache.xalan.xslt.Process
-ENTITYRESOLVER org.apache.xml.resolver.tools.CatalogResolver
-URIRESOLVER org.apache.xml.resolver.tools.CatalogResolver
-IN "C:\temp\foo1.xml"
-XSL "C:\temp\foobar.xslt"
-OUT "C:\temp\foo.html"

Verbose output from the catalog resolver:

Parse catalog: C:///temp/catalog/catalog2.xml
Loading catalog: C:///temp/catalog/catalog2.xml
Default BASE: file:C:///temp/catalog/catalog2.xml
xml:base: file:///C:/temp/
BASE CUR: file:C:///temp/catalog/catalog2.xml
BASE STR: file:///C:/temp/
BASE NEW: file:/C:/temp/
override: yes
OVERRIDE: yes
public: -//TTA//DTD DUMMY 1.0//EN
        dtd/dummy.dtd
PUBLIC: -//TTA//DTD DUMMY 1.0//EN
        file:/C:/temp/dtd/dummy.dtd
(reset) xml:base: file:C:///temp/catalog/catalog2.xml
BASE CUR: file:/C:/temp/
BASE STR: file:C:///temp/catalog/catalog2.xml
BASE NEW: file:/C:/temp/C:///temp/catalog/catalog2.xml
Parse catalog: C:///temp/catalog/catalog2.xml
Loading catalog: C:///temp/catalog/catalog2.xml
Default BASE: file:C:///temp/catalog/catalog2.xml
xml:base: file:///C:/temp/
BASE CUR: file:C:///temp/catalog/catalog2.xml
BASE STR: file:///C:/temp/
BASE NEW: file:/C:/temp/
override: yes
OVERRIDE: yes
public: -//TTA//DTD DUMMY 1.0//EN
        dtd/dummy.dtd
PUBLIC: -//TTA//DTD DUMMY 1.0//EN
        file:/C:/temp/dtd/dummy.dtd
(reset) xml:base: file:C:///temp/catalog/catalog2.xml
BASE CUR: file:/C:/temp/
BASE STR: file:C:///temp/catalog/catalog2.xml
BASE NEW: file:/C:/temp/C:///temp/catalog/catalog2.xml
resolveSystem(file:///C:/temp/foo.dtd)
resolvePublic(-//TTA//DTD FOO 1.0//EN,file:///C:/temp/foo.dtd)

(Location of error unknown)XSLT Error
(javax.xml.transform.TransformerException)
: java.io.FileNotFoundException: C:\temp\foo.dtd (The system cannot find the
fil
e specified)

It appears that catalog1.xml is not being loaded from the processing
instruction and this is causing the dtd location resolution to fail.

My (probably faulty) understanding of the XML catalog spec (section 5.1) is
that catalogs identified in processing instructions should be processed in
addition to any user- or system-defined catalog entry file lists.

I have been using Xalan Java 2.5.2 on Windows 2000 pro (SP 4).

Results of the Xalan environment check seems to indicate that I have set
everything up OK:

#---- BEGIN writeEnvironmentReport($Revision: 1.23 $): Useful stuff
found: ----
version.DOM.draftlevel=2.0fd
java.class.path=C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;
C:\Program Files\xalan\xalan-j_2_5_2\bin\;
C:\Program Files\xalan\xalan-j_2_5_2\bin\resolver.jar;
C:\Program Files\xalan\xalan-j_2_5_2\bin\resolver-1.0.jar;
C:\Program Files\xalan\xalan-j_2_5_2\bin\CatalogManager.properties;
version.JAXP=1.1 or higher
java.ext.dirs=C:\j2sdk1.4.2_03\jre\lib\ext
#---- BEGIN Listing XML-related jars in:
foundclasses.sun.boot.class.path ----
xalan.jar-path=C:\j2sdk1.4.2_03\jre\lib\endorsed\xalan.jar
xercesImpl.jar-apparent.version=xercesImpl.jar from
xerces-2_4xercesImpl.jar-path=C:\j2sdk1.4.2_03\jre\lib\endorsed\xercesImpl.j
ar
xml-apis.jar-apparent.version=xml-apis.jar present-unknown-version
xml-apis.jar-path=C:\j2sdk1.4.2_03\jre\lib\endorsed\xml-apis.jar
#----- END Listing XML-related jars in:
foundclasses.sun.boot.class.path -----
version.xerces2=Xerces-J 2.4.0
version.xerces1=not-present
version.xalan2_2=Xalan Java 2.5.2
version.xalan1=not-present
version.ant=not-present
java.version=1.4.2_03
version.DOM=2.0
version.crimson=present-unknown-version
sun.boot.class.path=C:\j2sdk1.4.2_03\jre\lib\endorsed\xalan.jar;
C:\j2sdk1.4.2_03\jre\lib\endorsed\xercesImpl.jar;
C:\j2sdk1.4.2_03\jre\lib\endorsed\xml-apis.jar;
C:\j2sdk1.4.2_03\jre\lib\rt.jar;
C:\j2sdk1.4.2_03\jre\lib\i18n.jar;
C:\j2sdk1.4.2_03\jre\lib\sunrsasign.jar;
C:\j2sdk1.4.2_03\jre\lib\jsse.jar;
C:\j2sdk1.4.2_03\jre\lib\jce.jar;
C:\j2sdk1.4.2_03\jre\lib\charsets.jar;
C:\j2sdk1.4.2_03\jre\classes
version.SAX=2.0
version.xalan2x=Xalan Java 2.5.2
#----- END writeEnvironmentReport: Useful properties found: -----
# YAHOO! Your environment seems to be OK.


Any help would be greatly appreciated.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Andy Hatton
Documentation Manager
Tarantella Inc.
Tel: +44 (0)113 251 2199
E-mail: andrewh@tarantella.com
Fax: +44 (0) 113 251 2102
www.tarantella.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~