title: src-resolve: Cannot resolve the name 'PkReportsTo' to a(n) 'identity constraint' component. [XSD]
body: <p>I was trying to create FK and PK in the XML schema, but it is showing an error in the featured code above. Is shows the message: src-resolve: Cannot resolve the name 'PkReportsTo' to a(n) 'identity constraint' component. [XSD]</p>
     
  <pre><code>&lt;xs:schema 
  xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; 
  xmlns=&quot;http://www.ricardoterra.com.br&quot; 
  elementFormDefault=&quot;qualified&quot;&gt;
      &lt;xs:element name=&quot;employees&quot;&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name=&quot;employee&quot; maxOccurs=&quot;unbounded&quot;&gt; 
                      &lt;xs:complexType&gt;
                          &lt;xs:all&gt;
                              &lt;xs:element name=&quot;firstName&quot; type=&quot;xs:string&quot;&gt;&lt;/xs:element&gt;
                              &lt;xs:element name=&quot;lastName&quot; type=&quot;xs:string&quot;&gt;&lt;/xs:element&gt;
                              &lt;xs:element name=&quot;extension&quot;&gt;
                                  &lt;xs:simpleType&gt;
                                      &lt;xs:restriction base=&quot;xs:string&quot;&gt; 
                                          &lt;xs:pattern value=&quot;([x][1-9])\w+&quot;&gt;&lt;/xs:pattern&gt;
                                      &lt;/xs:restriction&gt;
                                  &lt;/xs:simpleType&gt;
                              &lt;/xs:element&gt;
                              &lt;xs:element name=&quot;email&quot;&gt;
                                  &lt;xs:simpleType&gt;
                                      &lt;xs:restriction base=&quot;xs:string&quot;&gt; 
                                          &lt;xs:pattern value=&quot;([a-z])\w+(@)([a-z])\w+(.[a-z]+)*&quot;&gt;&lt;/xs:pattern&gt;
                                      &lt;/xs:restriction&gt;
                                  &lt;/xs:simpleType&gt;
                              &lt;/xs:element&gt;
                              &lt;xs:element name=&quot;officeCode&quot; type=&quot;xs:string&quot;&gt;&lt;/xs:element&gt;
                              &lt;xs:element name=&quot;jobTitle&quot; type=&quot;xs:string&quot;&gt;&lt;/xs:element&gt;
                              &lt;xs:element name=&quot;reportsTo&quot; type=&quot;xs:integer&quot; minOccurs=&quot;0&quot;&gt;
                                
                              &lt;/xs:element&gt;
                          &lt;/xs:all&gt;
                          &lt;xs:attribute name=&quot;number&quot; type=&quot;xs:integer&quot;&gt;&lt;/xs:attribute&gt;
                      &lt;/xs:complexType&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
          &lt;xs:unique name=&quot;number&quot;&gt; 
              &lt;xs:selector xpath=&quot;employee&quot;&gt;&lt;/xs:selector&gt;
              &lt;xs:field xpath=&quot;@number&quot;&gt;&lt;/xs:field&gt;
          &lt;/xs:unique&gt;
          &lt;xs:key name=&quot;PkEmploye&quot;&gt;
              &lt;xs:selector xpath=&quot;employee&quot;/&gt;
              &lt;xs:field xpath=&quot;@number&quot;&gt;&lt;/xs:field&gt;
          &lt;/xs:key&gt;
          &lt;xs:key name=&quot;PkReportsTo&quot;&gt;
              &lt;xs:selector xpath=&quot;employee/reportsTo&quot;&gt;&lt;/xs:selector&gt;
              &lt;xs:field xpath=&quot;.&quot;&gt;&lt;/xs:field&gt;
          &lt;/xs:key&gt;
          &lt;xs:keyref name=&quot;FKtoReportsToEmployee&quot; refer=&quot;PkReportsTo&quot;&gt;
              &lt;xs:selector xpath=&quot;employee&quot;&gt;&lt;/xs:selector&gt;
              &lt;xs:field xpath=&quot;@number&quot;&gt;&lt;/xs:field&gt;
          &lt;/xs:keyref&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  <p>I am with a error at the part of my code:</p>
  <pre><code>&lt;xs:keyref name=&quot;FKtoReportsToEmployee&quot; refer=&quot;PkReportsTo&quot;&gt;
       &lt;xs:selector xpath=&quot;employee&quot;&gt;&lt;/xs:selector&gt;
       &lt;xs:field xpath=&quot;@number&quot;&gt;&lt;/xs:field&gt;
  &lt;/xs:keyref&gt;
  </code></pre>
  <p><strong>I don't know why.</strong></p>