title: XSD anytype and JAXB
body: <p>I have an xsd definition (from www.tmforum.org ossj common api v1.5)</p>
  
  <pre><code>&lt;element name="primaryKey" nillable="false"&gt;
     &lt;complexType mixed="false"&gt;                   
        &lt;complexContent mixed="false"&gt;
           &lt;extension base="anyType"/&gt;                   
        &lt;/complexContent&gt;
     &lt;/complexType&gt;
  &lt;/element&gt;
  </code></pre>
  
  <p>and would like to generate an xml as follows</p>
  
  <pre><code>&lt;ossj-co-v1-5:primaryKey&gt;mykey&lt;/ossj-co-v1-5:primaryKey&gt;
  </code></pre>
  
  <p>The PrimaryKey class generated from the xsd using xjc requires a DOM Element to be stored in a list (see the generated PrimaryKey class at the bottom". "myKey" here is a TextNode and since its not an DOM Element, it cannot be added to xjc generated PrimaryKey class. How should I proceed to get the required output?</p>
  
  <p>Here is the PrimaryKey class generated from the xsd </p>
  
  <pre><code>    @XmlAccessorType(XmlAccessType.FIELD)
      @XmlType(name = "", propOrder = {
      "any"
      })
  public static class PrimaryKey {
  
      @XmlAnyElement
      protected List&lt;Element&gt; any;
      @XmlAnyAttribute
      private Map&lt;QName, String&gt; otherAttributes = new HashMap&lt;QName, String&gt;();
  
      public List&lt;Element&gt; getAny() {
          if (any == null) {
              any = new ArrayList&lt;Element&gt;();
          }
          return this.any;
      }
  
  
      public Map&lt;QName, String&gt; getOtherAttributes() {
          return otherAttributes;
      }
  
  }
  </code></pre>