Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.11.0
-
None
Description
For the following schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType><xs:sequence>
<xs:element name="key" type="xs:string" minOccurs="0">
<xs:key name="key">
<xs:selector xpath="."/>
<xs:field xpath="."/>
</xs:key>
</xs:element>
<xs:element name="keyref">
<xs:complexType>
<xs:attribute name="att" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence></xs:complexType>
<xs:keyref name="keyref" refer="key">
<xs:selector xpath="keyref"/>
<xs:field xpath="@att"/>
</xs:keyref>
</xs:element>
</xs:schema>
And XML:
<root>
<key>xyz</key>
<keyref att="xyz"/>
</root>
This should be valid, because the key and keyref matches. And
<root>
<keyref att="xyz"/>
</root>
Should be invalid, because there is no key for the keyref. But
<root>
<keyref/>
</root>
Should be valid, because there is no "att" attribute present, so the keyref is incomplete and doesn't need a key. But Xerces produces the error:
[Error] ...:3:8: Identity Constraint error: identity constraint "KeyRef@860d49" has a keyref which refers to a key or unique that is out of scope.