I have a large collection of objects (lets call them "containers") each holding two
ArrayLists and two
doubles. What I need to do is to generate a XML-based report from this collection according to the following format:
<row> <ref> <db>DB-name</db> <value>DB-Id</value> </ref> <value> <no>0</no> <value>val1</value> </value> <value> <no>1</no> <value>val2</value> </value> <value> <no>2</no> <value>val3</value> </value> </row>
Here the value of DB-name is constant throughout, however the DB-Id.s are stored in the lists. values val1, val2 and val3 are calculated from the two doubles in the container object. What I need to do is to create a row-tag for each id stored in the lists, with the same values (as all the id.s in the container object share these values).
I have been looking examples at the XStream webpage but couldn't find a nice way to tackle the problems that apply to my situation here, instead got a bit more confused as to if what I want/need to do is achievable or do I have to write my own XMLWriter implementation...
Any ideas as to how I can achieve this?