title: Referencing multiple IDs in an XML schema (XSD)
body: <p>I was wondering whether it's possible to differentiate between ID fields in an XML schema. I'm having the following schema:</p>
  
  <pre><code>&lt;element name="define_apple"&gt;
      &lt;complexType&gt;
          &lt;attribute name="colour" type="ID"/&gt;
      &lt;/complexType&gt;
  &lt;/element&gt;
  
  &lt;element name="define_orange"&gt;
      &lt;complexType&gt;
          &lt;attribute name="colour" type="ID"/&gt;
      &lt;/complexType&gt;
  &lt;/element&gt;
  
  &lt;element name="reference_apple"&gt;
      &lt;complexType&gt;
          &lt;attribute name="colour" type="IDREF"/&gt;
      &lt;/complexType&gt;
  &lt;/element&gt;
  
  &lt;element name="reference_orange"&gt;
      &lt;complexType&gt;
          &lt;attribute name="colour" type="IDREF"/&gt;
      &lt;/complexType&gt;
  &lt;/element&gt;
  </code></pre>
  
  <p>However, the references are not uniquely linked to the respective definitions. I can still write the following nonsense but valid XML:</p>
  
  <pre><code>&lt;define_apple colour="green"/&gt;
  &lt;define_orange colour="orange"/&gt;
  
  &lt;reference_apple colour="orange"/&gt;
  &lt;reference_orange colour="green"/&gt;
  </code></pre>
  
  <p>Is there a way to link the fields correctly using ID and IDREF, for instance using namespaces? I know I could just use key and keyref, but the ID thing is a bit more appealing to me.</p>