my question is: from the xml scheme :
<topnode>
topNodeValue
<bottomnode/>
</topnode>
generated class with Jaxb looks like
class topnode {
List<bottomnode> bottomnodeList;
}
Which does not generate the value field to set value for topnode.
How can I acheive this? Thanks.
When the contents of an element contain both character and element data it is called mixed content. In JAXB (JSR-222) this is mapped with the @XmlMixed annotation like:
class topnode {
@XmlMixed
String text;
List<bottomnode> bottomnodeList;
}
The use of mixed content can be tricky, since you may get unexpected results due to text nodes used for formatting. For a more detailed explanation see the following answer to a similar question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With