You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Guillaume Rousse <ro...@ccr.jussieu.fr> on 2002/01/11 15:19:30 UTC

crimson problem: no resolveEntity() callback

Hello.
I'm trying to resolve problem concerning use of crimson with argouml. Latest 
CVS version loads document fine using xerces-j 1.4.4, but fails using crimson 
1.1.3, with following message: "unable to resolve relative URI with no base 
URI"

Here is code snipplet:
public abstract class SAXParserBase extends HandlerBase {
[...]
 SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setNamespaceAware(false);
    factory.setValidating(false);
    try {
      SAXParser parser = factory.newSAXParser();
      InputSource input = new InputSource(is);
      parser.parse(input,this);
    }
[...]
}
I found that resolveEntity() callback occurs using xerces-j, but not with 
crimson. I tried to register explicitly the class as entity resolver :
parser.getXMLReader().setEntityResolver(this);
No more success.

Any help appreciated
-- 
Guillaume Rousse <ro...@ccr.jussieu.fr>
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: crimson problem: no resolveEntity() callback

Posted by Guillaume Rousse <ro...@ccr.jussieu.fr>.
Ainsi parlait Edwin Goei :
> Guillaume Rousse wrote:
> > Hello.
> > I'm trying to resolve problem concerning use of crimson with argouml.
> > Latest CVS version loads document fine using xerces-j 1.4.4, but fails
> > using crimson 1.1.3, with following message: "unable to resolve relative
> > URI with no base URI"
> >
> > Here is code snipplet:
> > public abstract class SAXParserBase extends HandlerBase {
> > [...]
> >  SAXParserFactory factory = SAXParserFactory.newInstance();
> >     factory.setNamespaceAware(false);
> >     factory.setValidating(false);
> >     try {
> >       SAXParser parser = factory.newSAXParser();
> >       InputSource input = new InputSource(is);
> >       parser.parse(input,this);
> >     }
> > [...]
> > }
> > I found that resolveEntity() callback occurs using xerces-j, but not with
> > crimson. I tried to register explicitly the class as entity resolver :
> > parser.getXMLReader().setEntityResolver(this);
> > No more success.
>
> Does your instance doc contains a relative URI reference to a DTD?  If
> so, then the parser cannot resolve it b/c the InputSource does not have
> an associated URI.  You might try InputSource.setSystemID() to set the
> base URI of the instance doc.
The document has relative references to a dtd and other documents, but all 
documents comes from a compressed file, and the dtd is part of the 
application archive, so i doubt a SystemID() will be of any help there. The 
custom EntityResolver is the correct solution, but i can't understand why 
only xerces-j uses it, and not crimson.
-- 
Guillaume Rousse <ro...@ccr.jussieu.fr>
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: crimson problem: no resolveEntity() callback

Posted by Edwin Goei <ed...@sun.com>.
Guillaume Rousse wrote:
> 
> Hello.
> I'm trying to resolve problem concerning use of crimson with argouml. Latest
> CVS version loads document fine using xerces-j 1.4.4, but fails using crimson
> 1.1.3, with following message: "unable to resolve relative URI with no base
> URI"
> 
> Here is code snipplet:
> public abstract class SAXParserBase extends HandlerBase {
> [...]
>  SAXParserFactory factory = SAXParserFactory.newInstance();
>     factory.setNamespaceAware(false);
>     factory.setValidating(false);
>     try {
>       SAXParser parser = factory.newSAXParser();
>       InputSource input = new InputSource(is);
>       parser.parse(input,this);
>     }
> [...]
> }
> I found that resolveEntity() callback occurs using xerces-j, but not with
> crimson. I tried to register explicitly the class as entity resolver :
> parser.getXMLReader().setEntityResolver(this);
> No more success.

Does your instance doc contains a relative URI reference to a DTD?  If
so, then the parser cannot resolve it b/c the InputSource does not have
an associated URI.  You might try InputSource.setSystemID() to set the
base URI of the instance doc.

-Edwin

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org