title: Semantic difference between element and complexType in XSD
body: <p>Given this XSD:</p>
  
  <pre><code>&lt;xsd:element name="ServiceList"&gt;
      &lt;xsd:complexType&gt;
          &lt;xsd:sequence&gt;
              ...
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  
  &lt;xsd:complexType name="ServiceList"&gt;
      &lt;xsd:sequence&gt;
          ...
      &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  </code></pre>
  
  <p>What is kind of the semantic difference between these two? I.e. named <code>element</code>s and <code>complexType</code>s which are direct children of a <code>schema</code>.</p>
  
  <p>The reason for me asking is that I tried doing this in an XSD:</p>
  
  <pre><code>&lt;xsd:element name="AvailableServices" type="cm:ServiceList" /&gt;
  &lt;xsd:element name="ExistingServices" type="cm:ServiceList" /&gt;
  &lt;xsd:complexType name="ServiceList"&gt;
      &lt;xsd:sequence&gt;
          ...
      &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  </code></pre>
  
  <p>But when this was compiled into Java classes using the Maven JAXB plugin, I am only able to create a <code>new ServiceList()</code>. <code>AvailableServices</code> and <code>ExistingServices</code> doesn't seem to even exist among the generated classes. So, what's going on here?</p>