title: JAXB binding simple types
body: <p>I'm trying to generate classes from an xsd but I'm getting the following exception when trying to customize a simple type:</p>
  
  <pre><code>    com.sun.istack.SAXParseException2: A type safe enum customization is specified to a simple type that cannot be mapped to a type safe enum.
  </code></pre>
  
  <p>The declaration of the simple type that throws the exception is as follows:</p>
  
  <pre><code>    &lt;xs:simpleType name="BroadcastAlertsItem"&gt;
      &lt;xs:annotation&gt;
          &lt;xs:appinfo&gt;
          reserved (0)
          broadcastAlertsAccepted (1)
          broadcastAlertsNotAccepted (2)
       &lt;/xs:appinfo&gt;
      &lt;/xs:annotation&gt;
      &lt;xs:union&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:unsignedInt"&gt;
                  &lt;xs:minInclusive value="0"/&gt;
                  &lt;xs:maxInclusive value="2"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:enumeration value="reserved"/&gt;
                  &lt;xs:enumeration value="broadcastAlertsAccepted"/&gt;
                  &lt;xs:enumeration value="broadcastAlertsNotAccepted"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:union&gt;
  &lt;/xs:simpleType&gt;
  </code></pre>
  
  <p>And this is the binding from the binding customization file:</p>
  
  <pre><code>    &lt;jaxb:bindings node="//xs:simpleType[@name='BroadcastAlertsItem']"&gt;
          &lt;jaxb:typesafeEnumBase name="BroadcastAlertsItem"&gt;
              &lt;jaxb:typesafeEnumMember name="reserved"/&gt;
              &lt;jaxb:typesafeEnumMember name="broadcastAlertsAccepted"/&gt;
              &lt;jaxb:typesafeEnumMember name="broadcastAlertsNotAccepted"/&gt;
          &lt;/jaxb:typesafeEnumBase&gt;
      &lt;/jaxb:bindings&gt;
  </code></pre>
  
  <p>As you will suppose, I have tried many more ways to achieve this goal :(</p>
  
  <p>Does anybody know if there is a way to bind that simple type without modifying the xsd file?</p>
  
  <p>Thank you very much.</p>