Results 1 to 1 of 1
- 01-04-2009, 10:24 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 4
- Rep Power
- 0
Storing and Retrieving Data Using XStream & xml Files
Hi all!
I'm very frustrated, I've spent hours, probably an entire day in all, trying to find an extremely concise example of how to store and retrieve data using XStream / XML files. Before answering, please read on, and please keep in mind that I'm, relatively speaking, a beginner or advanced beginner.
Let's say I have an address book which contains a "Person.java" class (String name, String address, String phoneNumber) and an "AddressBook.java" class containing an ArrayList<Person> and possibly other fields. I also have a main or test class...
I want to save everything in the address book in an xml file using XStream and, more importantly, be able to retrieve the data.
First Question: WHERE?
I think what I want to do is create a save() and load() method (is that right?), however I don't know where to put them and how to use them! In the AddressBook class? Shall I call it everytime there is a change so that any changes are automatically saved? (in all setters and constructors)? What's the best way to organize this?
Second Question: WANTED: SIMPLE, CLEAR, CONCISE CODE WITH SIMPLE, CLEAR, CONCISE COMMENTS AND NO ADDITIONAL EXPLANATION, I BEG YOU!!!
I actually don't want an answer, code tells me much more than lengthy explanations. What I would like is working code that I could cut, paste and test for the above (save() and load() or whatever/however is the best way to do this.). The shorter, the better.
Thank you so much, and I really look forward to hearing from you.
Desperately yours,
geeeeky.girlLast edited by geeeeky.girl; 01-04-2009 at 11:06 PM.
Similar Threads
-
storing exel data to access database
By sijokunnappilly in forum Advanced JavaReplies: 1Last Post: 10-30-2008, 07:59 AM -
parsing/storing large text data
By hkansal in forum New To JavaReplies: 4Last Post: 10-19-2008, 06:34 PM -
problems about storing binary data to mysql db using PreparedStatement
By xiechao in forum New To JavaReplies: 0Last Post: 04-22-2008, 11:57 AM -
Storing data permanently
By shaungoater in forum New To JavaReplies: 2Last Post: 03-10-2008, 04:18 PM -
Storing Data
By Khorod in forum New To JavaReplies: 1Last Post: 08-03-2007, 05:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks