Radu Coravu created XERCESJ-1585:
------------------------------------
Summary: Change in behavior when a keyref refers an out-of-scope
unique or key
Key: XERCESJ-1585
URL: https://issues.apache.org/jira/browse/XERCESJ-1585
Project: Xerces2-J
Issue Type: Bug
Components: XML Schema 1.0 Structures
Affects Versions: 2.11.0
Reporter: Radu Coravu
If I have the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<Top xmlns="www.bla.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="www.bla.com test.xsd">
<Sub_1>
<Sub_2/>
<Sub_2/>
</Sub_1>
<Sub_1a>
<Sub_2a/>
</Sub_1a>
</Top>
and validate it with the following XML Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="www.bla.com" xmlns:ns="www.bla.com">
<xs:element name="Top">
<xs:complexType>
<xs:sequence>
<xs:element name="Sub_1">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Sub_2">
<xs:complexType>
<xs:attribute name="SubID" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:key name="newKey">
<xs:selector xpath="Sub_2a"/>
<xs:field xpath="@SubID"/>
</xs:key>
</xs:element>
<xs:element name="Sub_1a">
<xs:complexType>
<xs:sequence>
<xs:element name="Sub_2a">
<xs:complexType>
<xs:attribute name="SubIDPtr"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:keyref name="newKeyref" refer="ns:newKey">
<xs:selector xpath="Sub_2a"/>
<xs:field xpath="SubIDPtr"/>
</xs:keyref>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
In Xerces 2.9.0 the following error was reported:
Identity Constraint error: identity constraint "KeyRef@79ff89" has a keyref
which refers to a key or unique that is out of scope.
@Line 11 Column 14
In Xerces 2.11.0 (using the 'xerces-java-xml-schema-1.1-dev' branch) the sample
is considered valid when validated either with XML Schema 1.0 or 1.1 support.
Was there any functionality lost?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]