title: XSD: Choice between element and attribute
body: <p>I'd like to have an element with either a content, or a certain attribute but not both.
  The element can look like this:</p>
  
  <pre><code>&lt;Location ref="blah"/&gt;
  </code></pre>
  
  <p>or this:</p>
  
  <pre><code>&lt;Location&gt; &lt;aaaLocation&gt;...&lt;/aaaLocation&gt; &lt;Location&gt;
  </code></pre>
  
  <p>But not like this:</p>
  
  <pre><code> &lt;Location ref="blah"&gt; &lt;aaaLocation&gt;...&lt;/aaaLocation&gt; &lt;Location&gt;
  </code></pre>
  
  <p>I tried somee variations of this:</p>
  
  <pre><code>&lt;xs:complexType name="FatherOfLocatiion"&gt;
          &lt;xs:choice&gt;
              &lt;xs:element name="Location"&gt;
                  &lt;xs:complexType&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element name ="aaaLocation" type="Alocation"/&gt;
                      &lt;/xs:sequence&gt;
                  &lt;/xs:complexType&gt;
              &lt;/xs:element&gt;
              &lt;xs:element name="Location"&gt;
                  &lt;xs:complexType&gt;
                      &lt;xs:attribute name="ref" type="xs:string" /&gt;
                  &lt;/xs:complexType&gt;
              &lt;/xs:element&gt;
          &lt;/xs:choice&gt;
          &lt;xs:attribute name="name" type="xs:string" use="required"/&gt;
      &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>The schema was valid in tools like XML spy, but when i tried to use jaxb to generate objects from it i got the following error:</p>
  
  <p>Multiple elements with name 'Location', with different types, appear in the model group.</p>
  
  <p>Is there any other way to enforce it?</p>