title: JAXB element of type enum
body: <p>So I know how to create an enum type but when I set an element type to it the element field will just be of type string and not of type enum. How do I create an enum in my schema and have JAXB generate it as a java enum type?</p>
  
  <p>This is how I'm doing my enum type and element creation:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;xsd:simpleType name="myEnum"&gt;
      &lt;xsd:restriction base="xsd:string"&gt;
          &lt;xsd:enumeration value="MY_ENUM_1"/&gt;
          &lt;xsd:enumeration value="MY_ENUM_2"/&gt;
      &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;
  
  &lt;xsd:element name="myEnumElement" type="ns1:myEnum"/&gt;
  </code></pre>