title: XML schema primary key
body: <p>I'm trying to create XML database for employees and I have problem with the schema. </p>
  
  <p>For each employee, I have four elements: name, surname, ID and email. How can I set ID as primary key and email as unique?  </p>
  
  <p>I tried this for primary key: </p>
  
  <pre><code>&lt;xs:key msdata:PrimaryKey="true" type="xs:string" name="ID"/&gt; 
  </code></pre>
  
  <p>but it's not working. 
  This is all my XML code: </p>
  
  <pre><code>&lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;xs:element name="employees"&gt;
  &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="employee"&gt;
        &lt;xs:complexType&gt;
          &lt;xs:sequence&gt;        
            &lt;xs:element type="xs:string" name="Name"/&gt;
            &lt;xs:element type="xs:string" name="Surname"/&gt;
            &lt;xs:element type="xs:string" name="ID"/&gt;
            &lt;xs:element type="xs:string" name="e-mail"/&gt;
          &lt;/xs:sequence&gt;
        &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
       &lt;xs:key name="empl-key"&gt;
          &lt;xs:selector xpath="employee"/&gt;
          &lt;xs:field xpath="@ID"/&gt;
       &lt;/xs:key&gt;
   &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>Thanks in advance. </p>