File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes How to store arraylist in xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to store arraylist in xml file " Watch "How to store arraylist in xml file " New topic
Author

How to store arraylist in xml file

Aditi Bhalerao
Greenhorn

Joined: Mar 10, 2010
Posts: 3
My arraylist consists of beans of attrs: datasize, dataused, date
ArrayList<Beans> ie.

Xml pattern required:

<?xml version="1.0" encoding="UTF-8" ?>
<data>
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-09" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-08" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-10" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-11" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-15" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-16" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-17" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-18" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-19" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-22" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-23" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-24" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-25" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-02-26" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-02" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-03" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-04" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-05" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-09" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-10" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-11" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-12" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-17" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-18" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-19" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-22" />
<record DATASIZE="20.0" DATAUSED="1.8359375" DATE="2010-03-23" />
</data>

to be stored in xml file.This format is the required format as per API that i am using to display the graphical stuff.
this xml wud be read at the runtime from cache where this file is stored and wud display these values in graphical representation.

how can i achieve generation of xml file in required format???

this is my first ever project involving XMLs kindly help even if problem seems silly and simple.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12783
    
    5
how can i achieve generation of xml file in required format???


An XML document file is just text, nothing magical. Just write the file out with println statements, no need to get tangled up with JAXB or other apis.

Bill
Loganathan Murugesan
Greenhorn

Joined: May 13, 2010
Posts: 3
try out XML beans.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to store arraylist in xml file