title: How to use Unions in a Schema
body: <p>In the schema below, there are three different simple types created (i.e., TestSexType, TestSexType2, and TestSEXCodeSimpleType).  The first two define one enumerated value, while the latter is a union comprised of the first two types.  Then, two elements are created, one of TestSexType2 type and one of TestSEXCodeSimpleType type.  The TextSexType (defined in the union) isn't defined in the class that was generated from the schema.  Any ideas on what I am doing incorrectly?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- edited with XMLSpy v2012 rel. 2 sp1 (http://www.altova.com) by CA/CST/ES (US DEPT OF STATE) --&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="base" targetNamespace="base" elementFormDefault="unqualified" attributeFormDefault="unqualified"&gt;
    &lt;xs:simpleType name="TestSexType"&gt;
      &lt;xs:restriction base="xs:token"&gt;
        &lt;xs:enumeration value="Y"/&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
    &lt;xs:simpleType name="TestSexType2"&gt;
      &lt;xs:restriction base="xs:token"&gt;
        &lt;xs:enumeration value="Z"/&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
    &lt;xs:simpleType name="TestSEXCodeSimpleType"&gt;
      &lt;xs:union memberTypes="TestSexType TestSexType2"/&gt;
    &lt;/xs:simpleType&gt;
    &lt;xs:element name="TestSex" type="TestSEXCodeSimpleType"/&gt;
    &lt;xs:element name="SexElement" type="TestSexType2"/&gt;
  &lt;/xs:schema&gt;
  </code></pre>