Bug 47671 - unable to resolve a relative path
Summary: unable to resolve a relative path
Status: NEW
Alias: None
Product: XmlCommons - Now in JIRA
Classification: Unclassified
Component: Resolver (show other bugs)
Version: 1.x
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Commons Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-10 11:32 UTC by Dave Pawson
Modified: 2010-01-14 01:46 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Pawson 2009-08-10 11:32:00 UTC
catalog entry of

 <system
      systemId="erlref.dtd"
      uri="/files/erlang/dtds/erlref.dtd"
      
     />

Is never seen by the resolver. See http://www.sagehill.net/docbookxsl/WriteCatalog.html#ResolveDtdLoc


Yet http://xmlsoft.org/XSLT/xsltproc.html  catalog resolves this?

I.e. I think it should resolve appropriately

Marked as XSLTBug, since transform cannot take place
without DTD resolution


regards DaveP
Comment 1 Earl Hood 2009-08-10 16:27:31 UTC
What is the full catalog?
Does the path "/files/erlang/dtds/erlref.dtd" exist on
the filesystem?  Or have you set xml:base?

Have you tried setting the verbosity with the
xml.catalog.verbosity property. Set to 5 or larger to get maximum
verbosity.  This will determine if your catalog is actually getting
read and what the resolver does when resolving a uri.

What is the exact error message(s) you get?

If you can provide a reproducable test case, it will make
finding a solution faster.

BTW, I'm not an official maintainer of the resolver code,
but I had to dive into it over a year ago to fix bugs.
I believe some of my patches have been accepted, but
I do not think a new release of the resolver has been
done in quite some time.
Comment 2 Dave Pawson 2009-08-10 21:53:34 UTC
What is the full catalog?
Does the path "/files/erlang/dtds/erlref.dtd" exist on
the filesystem?  Or have you set xml:base?

Have you tried setting the verbosity with the
xml.catalog.verbosity property. Set to 5 or larger to get maximum
verbosity.  This will determine if your catalog is actually getting
read and what the resolver does when resolving a uri.

What is the exact error message(s) you get?

If you can provide a reproducable test case, it will make
finding a solution faster.

1. full catalog

<?xml version="1.0" encoding="utf-8"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
	 >
 <system
      systemId="erlref.dtd"
      uri="/files/erlang/dtds/erlref.dtd"            />
 <systemSuffix
      systemIdSuffix="xhtml-lat1.ent"
      uri="/files/erlang/dtds/xhtml-lat1.ent"     />
</catalog>

2. The dtd and entity file are in ./dtds /files/erlang/dtds
3. I had tried xml:base, but now removed.

Instance has 
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
a file of 
<erlref>&nbsp</erlref>

would test it.

I have CatalogManger.properties with verbosity set high.

Error reported is:

Parse catalog: erlang.catalog.xml                            
Loading catalog: erlang.catalog.xml
Default BASE: file:////files/erlang/erlang.catalog.xml
system: erlref.dtd
        /files/erlang/dtds/erlref.dtd
SYSTEM: erlref.dtd
        file:/files/erlang/dtds/erlref.dtd
systemSuffix: xhtml-lat1.ent
        /files/erlang/dtds/xhtml-lat1.ent
SYSTEM_SUFFIX: xhtml-lat1.ent
        file:/files/erlang/dtds/xhtml-lat1.ent
resolveSystem(file:/files/erlang/module.xsl)
resolveSystem(file:/files/erlang/erlang.xml)
resolveSystem(file:/files/erlang/erlref.dtd)
Error on line 2 column 37 of file:/files/erlang/erlang.xml:
  Error reported by XML parser: Cannot read from file:/files/erlang/erlref.dtd (/files/erlang/erlref.dtd (No such file or directory))
Transformation failed: Run-time errors were reported

HTH
Comment 3 Earl Hood 2009-08-11 08:00:03 UTC
(In reply to comment #2)
> resolveSystem(file:/files/erlang/module.xsl)
> resolveSystem(file:/files/erlang/erlang.xml)
> resolveSystem(file:/files/erlang/erlref.dtd)

The above verbosity implies (to me) that the parser is passing
the wrong system ID to the resolver.

I.e. Instead of the XML parser passing just "erlref.dtd" to
the resolver, the parser is first fully qualifying the system ID
(probably based upon the current working directory)
before it passes the system ID to the resolver.  Since the
catalog has no entry for "file:/files/erlang/erlref.dtd", the
resolver will find no matching entries.

The parser then attempts to load the file directory, which of
course fails since the file does not exist with given path.

At this time, this appears to be an XML parser problem.
The parser should only be passing "erlref.dtd" to the
resolver.

BTW, did you trim some of the diagnostic output?  It seems
the XML parser is calling Catalog directly versus the
CatalogResolver class that implements the SAX EntityResolver
and JAXP URIResolver interfances.  I see no debugging messages
from the CatalogResolver class.
Comment 4 Matthew Buckett 2010-01-14 01:46:08 UTC
I think that this bug may be a duplicate of: https://issues.apache.org/bugzilla/show_bug.cgi?id=28719