Reputation: 332
I have XML like this:
<FirstTag Attr="123">
<WrapperTag>
<EmbeddedTag>
....
</EmbeddedTag>
</WrapperTag>
</FirstTag>
and code:
class FirstTag{
EmbeddedTag tag;
}
i dont want write WrapperTag's class. What annotation should I use for EmbeddedTag?
Upvotes: 1
Views: 647
Reputation: 115
You will need to use:
@XmlRootElement(name = "FirstTag")
above your first class, and then use:
@XmlElementWrapper(name="Wrapper")
@XmlElement(name="Embedded Tag")
above your variables which you want as a wrapper and embedded.
Hope this helps.
Upvotes: 1