[ http://issues.apache.org/jira/browse/XERCESJ-682?page=all ]
     
Michael Glavassevich resolved XERCESJ-682:
------------------------------------------

    Resolution: Fixed

Just checked a fix into SVN. When a selector matches, only key IDCs are 
required to match all of their fields. Unique and keyref IDCs which only match 
some of their fields are not members of the "qualified node set" however this 
is not an error and we shouldn't be reporting one.

> Comination of fields in <xsd:unique> acts as <xsd:key>
> ------------------------------------------------------
>
>          Key: XERCESJ-682
>          URL: http://issues.apache.org/jira/browse/XERCESJ-682
>      Project: Xerces2-J
>         Type: Bug
>   Components: XML Schema Structures
>     Versions: 2.3.0
>  Environment: Operating System: Windows NT/2K
> Platform: PC
>     Reporter: ismael.cams
>     Assignee: Michael Glavassevich

>
> Overview Description:
> When defining a combination of fields that should be unique by means of the 
> <xsd:unique> element the defined fields are optional and don't need to be 
> available in the instance document. However when defining more than one field 
> under the <xsd:unique> element, Xerces generates an error message when one of 
> the fields is not present: "Not enough values specified for <unique> identity 
> constraint specified for element"
> Steps to Reproduce:
> schema.xsd
> -----------
> <?xml version="1.0"?>
> <xsd:schema xmlns:ipm="http://unique/test";
>                       xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>                       targetNamespace="http://unique/test";
>                       elementFormDefault="qualified">
>                       
> <xsd:element name="root">
>       <xsd:complexType>
>               <xsd:sequence>
>                       <xsd:element ref="ipm:node" minOccurs="0" 
> maxOccurs="unbounded"/>
>               </xsd:sequence>
>       </xsd:complexType>
>       <xsd:unique name="uniqueNode">
>               <xsd:selector xpath="ipm:node"/>
>               <xsd:field xpath="@name"/>
>               <xsd:field xpath="ipm:module/@name"/>
>       </xsd:unique>
> </xsd:element>
> <xsd:element name="node">
>       <xsd:complexType>
>               <xsd:sequence>
>                       <xsd:element name="module" minOccurs="0" maxOccurs="1">
>                               <xsd:complexType>
>                                       <xsd:attribute name="name" 
> type="xsd:string"/>
>                               </xsd:complexType>
>                       </xsd:element>
>               </xsd:sequence>
>               <xsd:attribute name="name" type="xsd:string"/>
>       </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> instance document
> -----------------
> <?xml version="1.0"?>
> <root xmlns="http://unique/test"; 
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>         xsi:schemaLocation="http://unique/test unique.xsd">
>         
> <node>
>       <module name="test2"/>
> </node>
> <node name="router">
>       <module name="test1"/>
> </node>
> </root>
> Validation is done with the sax.Counter class available in xercesSamples.jar.
> Usage: "java -classpath xercesSamples.jar;xercesImpl.jar;xmlParserAPIs.jar 
> sax.Counter -s -v unique.xml"
> Actual Results:
> Gives following output
> [Error] unique.xml:9:8: Not enough values specified for <unique> identity 
> constraint specified for element "root".
> Expected Results:
> Should be valid
> Build Date & Platform:
> First encountered with XercesJ-2.0.0
> Replaced the jar files with those of XercesJ-2.3.0 but still encountered the 
> same problem
> Additional Information:
> The problem only occurs when defining a combination of fields. When only one 
> field there seems be no problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
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]

Reply via email to