Hi!
I'm a java rookie and I'm trying to learn how to read and write to xml documents. I have a xml-file called tasklist which lies directly in the src directory, at the same level as the executing program but I get the following error:
java.io.FileNotFoundException: tasklist.xml (Det går inte att hitta filen)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at nr.xml.stax.read.StaXParser.readTasks(StaXParser.java:35)
at TestRead.main(TestRead.java:9)
and here's the code:
import java.util.List;
import nr.xml.stax.model.Task;
import nr.xml.stax.read.StaXParser;
public class TestRead {
public static void main(String args[]) {
StaXParser read = new StaXParser();
List<Task> readTasks = read.readTasks("tasklist.xml");
for (Task task : readTasks) {
System.out.println(task);
}
}
}
As I said is the two files in the same directory so I just can't understand why it won't find the file!
All help and comments are welcome!