• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to store arraylist in xml file

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try out XML beans.
 
reply
    Bookmark Topic Watch Topic
  • New Topic