I have an object x which I want to marshal into a file.
xml of x :
<x id="0"><f1>bla</f1><f2>bla </f2><f3>bla</f3></x>
this part I figured out … but if I have a list of x’s which I want to write to a file.
but I want to start the file with
<z>
<y>
<k>
<x id="1"> ... </x>
<x id="2"> ... </x>
<x id="3"> ... </x>
</k>
</y>
</z>
is there anyway we can do this with marshel ?!
add the z y and k then the list of x’s and the close z y and k ?!
Thank you …
You could leverage JAXB and StAX and do something like the following:
Output
FORMATTING
To get some formatting you could do:
Output