You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Mukul Gandhi (JIRA)" <xe...@xml.apache.org> on 2013/01/13 13:30:26 UTC

[jira] [Commented] (XERCESJ-1594) Key/Keyref are not validated correctly

    [ https://issues.apache.org/jira/browse/XERCESJ-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13552185#comment-13552185 ] 

Mukul Gandhi commented on XERCESJ-1594:
---------------------------------------

@ Octavian: just committed changes to implementation for your latest comment (the relevant SVN version is 1432596). though I've few personal opinions to your comments, as follows:

wrt first comment: this feature is designed like this since Xerces-J 2.9.1. we've been reporting only one error for such cases (even if multiple "keyref" references are wrong). I would not like to go, to change this long kept feature.

wrt second comment: I agree with you, and have modified the implementation accordingly.


Thanks.
                
> Key/Keyref are not validated correctly
> --------------------------------------
>
>                 Key: XERCESJ-1594
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1594
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Octavian Nadolu
>            Assignee: Mukul Gandhi
>
> The Key/Keyref it is not validated correctly. I tested on the xml-schema-1.1-dev branch. 
> You can reproduce it if you validate the XML instance "instance.xml" with the XML Schema "schema.xsd". When you validate the XML file there should be two errors because the "ref" elements refers to invalid keys.
> As a hint, this happens only if the last "person" element does not have a "ref" element as child.
> ----instance.xml-----------------
> <personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd">
>     <person id="111">
>         <name>name</name>
>         <ref>1</ref>
>     </person>
>     <person id="222">
>         <name>name</name>
>         <ref>2</ref>
>     </person>
>     <person id="333">
>         <name>name</name>
>     </person>
> </personnel>
> ----------------------------------------
> ----schema.xsd------------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:element name="personnel">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element ref="person" maxOccurs="unbounded"/>
>       </xs:sequence>
>     </xs:complexType>
>     <xs:key name="key">
>       <xs:selector xpath="person"/>
>       <xs:field xpath="@id"/>
>     </xs:key>
>     <xs:keyref refer="key" name="keyref">
>       <xs:selector xpath="person"/>
>       <xs:field xpath="ref"/>
>     </xs:keyref>
>   </xs:element>
>   <xs:element name="person">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="name" type="xs:string"/>
>         <xs:element name="ref" type="xs:integer" minOccurs="0"/>
>       </xs:sequence>
>       <xs:attribute name="id" type="xs:integer" use="required"/>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> ----------------------------------------

--
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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org