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

Michael Glavassevich updated XERCESJ-682:
-----------------------------------------

    Bugzilla Id:   (was: 18405)
    Fix Version: 2.8.0
    Description: 
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.

  was:
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.

    Environment: 
Operating System: Windows NT/2K
Platform: PC

  was:
Operating System: Windows NT/2K
Platform: PC

       Priority: Blocker

> 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
>     Priority: Blocker
>      Fix For: 2.8.0

>
> 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