As a summary: I need to place some fields directly into the root tag, skipping the tag of their direct parent.
Detailed description:
I have these classes:
@XmlRootElement
class Root{
protected Group1 group1;
protected Group2 group2;
}
@XmlRootElement
class Group1 {
protected String field1;
protected String field2;
...
protected String field99;
}
@XmlRootElement
class Group2 {
protected String field101;
...
protected String field199;
}
Default JAXB marshalling will produce this XML:
<root>
<group1>
<field1></field1>
<field2></field2>
...
<field99></field99>
</group1>
<group2>
<field100></field100>
...
<field199></field199>
</group2>
</root>
I need the output to skip the parent tags (group1 and group2), and to incorporate the fields directly into the root element:
<root>
<field1></field1>
<field2></field2>
...
<field99></field99>
<field100></field100>
...
<field199></field199>
</root>