title: How do I use JAXB @XmlValue on a subclass?
body: <p>I want XML like this:</p>
  
  <pre><code>&lt;simple&gt;Foo&lt;/simple&gt;
  </code></pre>
  
  <p>I can do this successfully via a JAXB class that looks like this:</p>
  
  <pre><code>@XmlRootElement(name="simple")
  class Simple {
      @XmlValue
      public String contents;
  }
  </code></pre>
  
  <p>But now I need to make the Simple class be a subclass of another class like so:</p>
  
  <pre><code>@XmlRootElement(name="simple")
  class Simple extends OtherClass {
      @XmlValue
      public String contents;
  }
  </code></pre>
  
  <p>That fails with <code>@XmlValue is not allowed on a class that derives another class.</code> 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?</p>