I am trying to serialize a couple of objects to xml with simplexml in Java. I have the following objects:
@Root()
class foo {
@ElementList
List<bar> foo;
}
@Root()
class bar {
@Element
String bar;
}
and the output is:
<foo>
<bar>
<bar>a</bar>
</bar>
<bar>
<bar>b</bar>
</bar>
...
</foo>
but, what i want is:
<foo>
<bar>a</bar>
<bar>b</bar>
...
</foo>
Any idea how this can be achieved? I'm working with legacy code and unfortunately I can't change the xml structure at all. I have a feeling that I probably need to create a custom serializer for the foo object so that the outer bar isn't serialized. Thanks!