[jdom-interest] SAXbuilder need a special path to access a file?
Justin Wall
jwall at interactivesites.com
Mon Aug 20 12:57:36 PDT 2001
I know this sounds trivial, but I've been staring at this since
Thursday. I can't get the SAXbuilder to read a file. Does the SAXbuilder
need a path set somewhere? I don't know what changed in my program or
IDE(I'm using Forte) to get this error, but this was working fine
earlier. I'm parsing a directory for filenames and then I pass the file to
the builder.
output:
File: f:\thxml\pioreport.xml (6779)
reading: f:\thxml\pioreport.xml
Error with: f:\thxml\pioreport.xml
Error on line 0: File "f:\thxml\pioreport.xml" not found.
This is the code that generates those lines:
//Set root dir !!DONT FORGET 2 BACKSLASHES
String dir = "f:\\thxml";
File file1 = new File(dir) ;
// Get all the files and directory under your diretcory
File[] strFilesDirs = file1.listFiles();
System.out.println( "File: " + strFilesDirs[i] + " (" +
strFilesDirs[i].length( ) + ")" );
parseFile(strFilesDirs[i].getPath());
public static void parseFile(String file1) { ...
SAXBuilder saxBuilder = new SAXBuilder();
System.out.println("reading: " + file1);
//create DOM object
Document xtfDoc = saxBuilder.build(file1);
in the catch block:
System.out.println("Error with: " + file1);
System.out.println(e.getMessage());
Thanks,
Justin Wall
More information about the jdom-interest
mailing list