JAXB - representing element as boolean?
- by Marcus
We have this XML:
<Summary>
<ValueA>xxx</ValueA>
<ValueB/>
</Summary>
<ValueB/> will never have any attributes or inner elements. It's a boolean type element - it exists (true) or it doesn't (false).
JAXB generated a Summary class with a String valueA member, which is good. But for ValueB, JAXB generated a ValueB inner class and a corresponding member:
@XmlElement(name = "ValueB")
protected Summary.ValueB valueB;
But what I'd like is a boolean member and no inner class:
@XmlElement(name = "ValueB")
protected boolean valueB;
How can you do this?
I'm not looking to regenerate the classes, I'd like to just make the code change manually.