Re: EntityResolver problem with Aelfred parser
Arnaud Vandyck <[email protected]> Fri, 09 Apr 2004 16:20:46 +0200
| Newsgroups | gmane.comp.java.classpath.extensions.discuss |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the report, I'll wait for some comments about it before applying the proposed patch: ,---- | line 585 of SAXDriver (package gnu.xml.aelfred2) | | in.setSystemId (absolutize (baseURI, in.getSystemId (), false)); | | the last argument of to absolutize should be true: the absolutize should | be 'nice=true' and thus return the unabsolutized systemId by giving a chance | to the call to EntityResolver in the next line: | | source = entityResolver.resolveEntity (in.getPublicId (), | in.getSystemId ()); `---- Many thanks, Maarten Coene <[email protected]> writes: > 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 > > > > _______________________________________________ > Classpathx-discuss mailing list > [email protected] > http://mail.gnu.org/mailman/listinfo/classpathx-discuss > > -- ~/.signature not found < doogie> asuffield: how do you think dpkg was originally written? :| < asuffield> by letting iwj get dangerously near a computer -- in #debian-devel