Hey guys,
We've been asked to create a application which utalises 3 kinds of IO, text, XML and serialization.
Text and Serialization went by without any hitches, but for some reason XML refuses to work.
Quick overview of the application here.
This is what I've got.
Going to the method -
The method itself
I can't see anything wrong there, can you?
Edit:- Important to note that the ArrayList with the book and author objects stored is also in this class - hense the (this).
We've been asked to create a application which utalises 3 kinds of IO, text, XML and serialization.
Text and Serialization went by without any hitches, but for some reason XML refuses to work.
Quick overview of the application here.
- Two classes, books and authors.
- Linked by the author instance variable.
- Method class with all of the methods inside (who would have guessed?)
This is what I've got.
Going to the method -
Code:
try {
writeXML("file.xml");
}
catch (IOException e) {
System.out.println("Error whilst writing file");
}
}
Code:
public void writeXML(String fn) throws IOException {
XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
new BufferedOutputStream(
new FileOutputStream(fn))));
encoder.writeObject(this);
encoder.close();
}
I can't see anything wrong there, can you?
Edit:- Important to note that the ArrayList with the book and author objects stored is also in this class - hense the (this).
Last edited: