17
I want XML like this:
<simple>Foo</simple>
I can do this successfully via a JAXB class that looks like this:
@XmlRootElement(name="simple")
class Simple {
@XmlValue
public String contents;
}
But now I need to make the Simple class be a subclass of another class like so:
@XmlRootElement(name="simple")
class Simple extends OtherClass {
@XmlValue
public String contents;
}
That fails with @XmlValue is not allowed on a class that derives another class. I can't easily refactor the superclass away (because of the way we're using @XmlElementRef on a wrapper class). Is there a workaround that will let me annotate my subclass to generate that simple XML?