Scope of keyref identity constraints (Xerces-J bug)

Hi,

Xerces-J 2.7.1 reports for the following (brain-hurting) scenario:

keyref-2.xml:7,15: (Error) Identity Constraint error:  identity
constraint "KeyRef@1995d80" has a keyref which refers to a key or
unique that is out of scope.

... while XSV 2.10, IBM's SQC, Saxon 8.5.1, MSXML 4.0 SP2 and
Libxml2 2.6.22 report it as valid.

keyref-2.xsd
------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="SECTION-A" type="Section">
	<xs:key name="DefKey">
      <xs:selector xpath="DEFINITION"/>
      <xs:field xpath="."/>
    </xs:key>
  </xs:element>

  <xs:element name="SECTION-B" type="Section">  
    <xs:keyref name="DefRef" refer="DefKey">
      <xs:selector xpath="DEFREF"/>
      <xs:field xpath="."/>
    </xs:keyref>
  </xs:element>

  <xs:complexType name="Section">
    <xs:sequence>
	  <xs:element ref="SECTION-A" minOccurs="0"/>
	  <xs:element ref="SECTION-B" minOccurs="0"/>
	  <xs:element name="DEFINITION" type="xs:string" minOccurs="0"
maxOccurs="2"/>
	  <xs:element name="DEFREF" type="xs:string" minOccurs="0"
maxOccurs="5"/>
	</xs:sequence>
  </xs:complexType>

</xs:schema>

keyref-2.xml
------------

<SECTION-A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="keyref-2.xsd">

  <SECTION-B>      
	  <DEFINITION>zappa</DEFINITION>
  </SECTION-B>
  <DEFREF>zappa</DEFREF>	

</SECTION-A>

Regards,

Kasimier

Received on Tuesday, 11 October 2005 12:41:20 UTC