• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

How to store arraylist in xml file

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
try out XML beans.
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic