Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDOM EOFException

843834Jun 23 2003 — edited Jun 24 2003
Hi all,

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.


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2003
Added on Jun 23 2003
3 comments
153 views