[jdom-interest] Bug in SAXBuilder.build(File)

Jason Hunter jhunter at xquery.com
Fri Dec 17 10:27:45 PST 2004


You say an input stream gave you the "same results"?  Well then the 
error doesn't have anything to do with the slashes in the path, right? 
Becuase the input stream doesn't depend on the path.  So perhaps your 
XML is just corrupt?

-jh-

Boris Lemus wrote:

> Hi
> It seems that SAXBuilder.build() method only support Linux style paths: 
> "/home/user/anything". I'm having a hard time trying to solve this 
> problem in Windows:
> 
>            f = new java.io.File(uri);
>            org.jdom.input.SAXBuilder saxB = new SAXBuilder();
>            doc = saxB.build(f);
> 
> let's suppose uri="D:/Dsitrib/conf/server.xml", the last line throws the 
> folowing exception:
> -------------------------------
> Errors in document format
> org.jdom.input.JDOMParseException: Error on line 1 of document 
> file:/D:/Dsitrib/conf/server.xml: Document root element missing.
> 
>        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:465)
>        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:810)
>        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:789)
> -------------------------
> 
> The build method adds a slash to the begining of the directory path!!!, 
> and of course no such a directory exists in Windows. I've tried passing 
> an input stream to the build method instead of a File object with the 
> same results.
> 
> Any ideas  or workarounds??
> 
> Thanks in advance
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 


More information about the jdom-interest mailing list