You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Marcus Weibull <ma...@aspiro.com> on 2001/09/17 17:11:03 UTC
Bug in Crimson
Hi!
I think I have found a bug in Crimson. The error occurs when I try to
parse an XML file using a FileInputStream see below:
When I try to parse a file with the following Java syntax I get a
JDOMException:
SAXBuilder builder = new SAXBuilder(false);
InputStream is = new FileInputStream(contentPath+results[i]);
Element docRoot = builder.build(is).getRootElement();
is.close();
after changing the code to the following it all worked fine:
SAXBuilder builder = new SAXBuilder(false);
Element docRoot = builder.build(new
File(contentPath+results[i])).getRootElement();
If I remove crimson.jar from my classpath it works fine with both
notations. To me it seems like crimson somehow get lost in the file
structure when using a stream instead of a File.
Any clues?
Here is the exceptions I got:
DailyHoroscopeContentHandler 2001-09-05 10:34:29 Error
Error buildng DOM file with horoscope data
DailyHoroscopeContentHandler 2001-09-05 10:34:29 StackTrace
----------------------------------------
org.jdom.JDOMException: Error on line 3: Relative URI
"../../DailyHoroscope/dat/dh.dtd"; can not be resolved without a
document URI.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java, Compiled
Code)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java, Compiled
Code)
at
com.aspiro.dailyhoroscope.content.DailyHoroscopeContentHandler.refreshCo
ntent(DailyHoroscopeContentHandler.java, Compiled
Code)
at
com.aspiro.dailyhoroscope.content.DailyHoroscopeContentHandler.<init>(Da
ilyHoroscopeContentHandler.java, Compiled Code)
at
com.aspiro.dailyhoroscope.me.WmlUserDailyHoroscopeMessageExecutor.<init>
(WmlUserDailyHoroscopeMessageExecutor.java, Compi
led Code)
at java.lang.reflect.Constructor.newInstance(Native Method)
at
com.aspiro.dispatcher.server.MessageExecutorFactory.fetch(MessageExecuto
rFactory.java, Compiled Code)
at
com.aspiro.dispatcher.server.MessageExecutorManager.fetch(MessageExecuto
rManager.java, Compiled Code)
at
com.aspiro.dispatcher.server.DispatcherServer.execute(DispatcherServer.j
ava, Compiled Code)
at
com.aspiro.dispatcher.server.DispatcherServer.dispatchMessage(Dispatcher
Server.java, Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java, Compiled
Code)
at sun.rmi.transport.Transport$1.run(Transport.java, Compiled
Code)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java,
Compiled Code)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java,
Compiled Code)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
va, Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
Root cause: org.xml.sax.SAXParseException: Relative URI
"../../DailyHoroscope/dat/dh.dtd"; can not be resolved without a
document UR
I.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java,
Compiled Code)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java,
Compiled Code)
at org.apache.crimson.parser.Parser2.parseSystemId(Parser2.java,
Compiled Code)
at
org.apache.crimson.parser.Parser2.maybeExternalID(Parser2.java, Compiled
Code)
at
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java,
Compiled Code)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java,
Compiled Code)
at org.apache.crimson.parser.Parser2.parse(Parser2.java,
Compiled Code)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java,
Compiled Code)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java, Compiled
Code)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java, Compiled
Code)
at
com.aspiro.dailyhoroscope.content.DailyHoroscopeContentHandler.refreshCo
ntent(DailyHoroscopeContentHandler.java, Compiled
Code)
at
com.aspiro.dailyhoroscope.content.DailyHoroscopeContentHandler.<init>(Da
ilyHoroscopeContentHandler.java, Compiled Code)
at
com.aspiro.dailyhoroscope.me.WmlUserDailyHoroscopeMessageExecutor.<init>
(WmlUserDailyHoroscopeMessageExecutor.java, Compi
led Code)
at java.lang.reflect.Constructor.newInstance(Native Method)
at
com.aspiro.dispatcher.server.MessageExecutorFactory.fetch(MessageExecuto
rFactory.java, Compiled Code)
at
com.aspiro.dispatcher.server.MessageExecutorManager.fetch(MessageExecuto
rManager.java, Compiled Code)
at
com.aspiro.dispatcher.server.DispatcherServer.execute(DispatcherServer.j
ava, Compiled Code)
at
com.aspiro.dispatcher.server.DispatcherServer.dispatchMessage(Dispatcher
Server.java, Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java, Compiled
Code)
at sun.rmi.transport.Transport$1.run(Transport.java, Compiled
Code)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java,
Compiled Code)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java,
Compiled Code)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
va, Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
DailyHoroscopeContentHandler 2001-09-05 10:34:29 StackTrace
----------------------------------------
Best Regards,
Marcus Weibull
****************************************
Marcus Weibull, Product Developer
Aspiro AB (publ.)
Office: Gråbrödersgatan 2, Malmö
P.O. Box 118, SE - 201 21 Malmö, Sweden
Phone: + 46 - 709 - 91 80 20
Fax: + 46 - 40 - 57 97 71
E-mail: mailto:marcus.weibull@aspiro.se
mailto:0709918020@euromail.se
(accessible through mobile and Internet)
WWW: http://www.aspiro.com <http://www.aspiro.com/>
****************************************
---------------------------------------------------------------------
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: Bug in Crimson
Posted by Harald Hett <h....@gis-systemhaus.de>.
Hi Marcus!
I am wondering that the first code example works with the other
implementations, because the Exception reads like this:
> org.jdom.JDOMException: Error on line 3: Relative URI
> "../../DailyHoroscope/dat/dh.dtd"; can not be resolved without a
> document URI.
This means that by using a FileInputStream there is no uri supplied to
the parser, which therfore cannot determine where the DTD lies
(../../DailyHoroscope/dat/dh.dtd).
Using File, the parser knows the location/uri of the source document and
thus is able to determine the relative Location of the DTD.
Bye,
Harald
--
Harald Hett <h....@gis-systemhaus.de>
Gesellschaft für integrierte Systemplanung
---------------------------------------------------------------------
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