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

Boris Lemus support at dateksa.com
Fri Dec 17 09:49:17 PST 2004

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

More information about the jdom-interest mailing list