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:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] 
(accessible through mobile and Internet) 
WWW: http://www.aspiro.com <http://www.aspiro.com/>  
**************************************** 

 

---------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to