xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandy Gao (JIRA)" <xerces-j-...@xml.apache.org>
Subject [jira] [Created] (XERCESJ-1515) Incomplete keyrefs should not need keys
Date Mon, 30 May 2011 19:43:47 GMT
Incomplete keyrefs should not need keys
---------------------------------------

                 Key: XERCESJ-1515
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1515
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.0 Structures, XML Schema 1.1 Structures
    Affects Versions: 2.11.0
            Reporter: Sandy Gao
            Assignee: Sandy Gao


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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


Mime
View raw message