EntityResolver problem with Aelfred parser

Maarten Coene <[email protected]> Fri, 09 Apr 2004 13:14:46 +0200
Newsgroups gmane.comp.java.classpath.extensions.discuss
Organization QMedit
Message-ID <[email protected]>
Hi,

I have a problem with specifying an EntityResolver with the Aelfred 
SAXDriver. In some situations, the specified EntityResolver will not be 
used to resolve the entities. This can happen if you pass an InputSource 
to the SAXDriver.parse( ... ) method without specifying a systemId.

I've found a related mail regarding this issue with a (possible) 
solution for this problem, but there were no replies...
http://mail.gnu.org/archive/html/classpathx-xml/2002-02/msg00016.html

For instance, parsing this document will throw an error and the 
specified EntityResolver has never been called:

<?xml version="1.0"?>
<!DOCTYPE greeting SYSTEM "hello.dtd">
<greeting>Hello, world!</greeting>

*code snippit illustrating the problem*
InputStream in = ....   // the xml document
EntityResolver myResolver = ... // a resolver that can handle "hello.dtd"

SAXDriver reader = new SAXDriver();
reader.setEntityResolver(myResolver);
reader.setContentHandler(...);
reader.parse(new InputSource(in));

*the exception*
this throws the following exception:
 java.net.MalformedURLException: no protocol: hello.dtd
        at java.net.URL.<init>(URL.java:567)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at SAXDriver.absolutize(SAXDriver.java:613)
        at SAXDriver.resolveEntity(SAXDriver.java:590)
        ...

regards,
Maarten