title: XSD unique attribute is not working
body: <p>The XSD unique constraint (serverId) is not working for schema: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
             targetNamespace="com.example.whatever"
             elementFormDefault="qualified"&gt;
  
      &lt;xs:complexType name="server"&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element name="serverName" type="xs:string"/&gt;
              &lt;xs:element name="port" type="xs:int"/&gt;
              &lt;xs:element name="bossThreadSize" default="2" type="xs:int"/&gt;
              &lt;xs:element name="workGroupSize" default="2" type="xs:int"/&gt;
          &lt;/xs:sequence&gt;
          &lt;xs:attribute name="serverId" use="required" type="xs:int"/&gt;
          &lt;xs:attribute name="jarName" use="required" type="xs:string"/&gt;
      &lt;/xs:complexType&gt;
  
      &lt;xs:element name="servers"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="server" type="server" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
          &lt;xs:unique name="uniqueId"&gt;
              &lt;xs:selector xpath="tns:server"/&gt;
              &lt;xs:field xpath="@serverId"/&gt;
          &lt;/xs:unique&gt;
      &lt;/xs:element&gt;
  
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>And my xml looks like this:</p>
  
  <pre><code>&lt;server serverId="1" jarName="frontServer"&gt;
      &lt;serverName&gt;FrontServer&lt;/serverName&gt;
      &lt;port&gt;3724&lt;/port&gt;
      &lt;bossThreadSize/&gt;
      &lt;workGroupSize/&gt;
  &lt;/server&gt;
  
  &lt;server serverId="1" jarName="frontServer"&gt;
      &lt;serverName&gt;FrontServer&lt;/serverName&gt;
      &lt;port&gt;3725&lt;/port&gt;
      &lt;bossThreadSize/&gt;
      &lt;workGroupSize/&gt;
  &lt;/server&gt;
  </code></pre>
  
  <p>So this xml validates successfully though two servers have the same server ids. What is wrong here?</p>