classpathx-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Classpathx-discuss] EntityResolver problem with Aelfred parser


From: Maarten Coene
Subject: [Classpathx-discuss] EntityResolver problem with Aelfred parser
Date: Fri, 09 Apr 2004 13:14:46 +0200
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]