[jdom-interest] EOFException

Rashad El Badrawi rbadrawi at lynx.dac.neu.edu
Mon Jun 23 15:34:20 PDT 2003


	Hi,

I am using JDOM (in Visual Age) to read a tiny xml file into a DOM tree.
The program is choking and throwing an exception.

- The exception ends with SAXBuilder.build(File) and can be tracked all
the way to XmlParser.popInput(). Its a java.io.EOFException.

- Here is the extremely simple code, and the input file is a very basic
xml file as well:

import java.io.*;
import java.util.*;

public class Temp { 

public static void main(String[] args) {

File f = new File("c:\\tutorial1.xml");
try {
BufferedReader br = new BufferedReader(new FileReader(f));
String temp;
while ((temp = br.readLine()) != null) {
System.out.println(temp);
}
} catch (IOException e) { e.printStackTrace();}
org.jdom.input.SAXBuilder saxBuilder = new org.jdom.input.SAXBuilder();
try {
org.jdom.Document doc = saxBuilder.build(f);
} catch (org.jdom.JDOMException jdomexception) {
System.out.println("Error");
if (jdomexception.getCause() != null) {
System.out.println(jdomexception.getCause().getMessage());
}
} catch (IOException e) {
e.printStackTrace();
}

}

}

- I know that the above code does not do much, I am planning to add to it.
I also directed Visual Age to add the following to the command line:
javax.xml.parsers.SAXParserFactory=com.icl.saxon.aelfred.SAXParserFactoryImpl

Thanks.





More information about the jdom-interest mailing list