I have a class that resembles something like this:
class foo {
List<String> bar;
...
}
I add four Strings to the list bar
:
bar.add("1");
bar.add("2");
bar.add("3");
bar.add("4");
Using xstream, I've managed to get output that looks like this:
<foo>
<bar>
<blah>1</blah>
<blah>2</blah>
<blah>3</blah>
<blah>4</blah>
</bar>
</foo>
However, I need XML that looks like this:
<foo>
<bar>
<blah id="1"/>
<blah id="2"/>
<blah id="3"/>
<blah id="4"/>
...
</bar>
</foo>
Can anybody help me with this?