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 "Jakub Mendys (JIRA)" <xe...@xml.apache.org> on 2005/02/02 16:12:23 UTC

[jira] Commented: (XERCESJ-1040) Identity-constraint validation with multiple fields is incorrect when namespaces are used

     [ http://issues.apache.org/jira/browse/XERCESJ-1040?page=comments#action_58510 ]
     
Jakub Mendys commented on XERCESJ-1040:
---------------------------------------

Sorry, I didn't know how cloneing works...

I have the very similar problems as in cloned issue but my applies to documents with namespace defined. Xerces seems to ignore references in that case. File examples are as follow

================ test.xml ===============
<?xml version="1.0" encoding="windows-1252"?>

<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.roche.com/dss/advent test.xsd"
 xmlns="http://www.roche.com/dss/advent">
  <value a="1" b="3"/>
  <value a="2" b="4"/>

  <ref x="1" y="3"/>
  <ref x="2" y="4"/>
  <ref x="1" y="4"/>
</test> 
===========================================

================= test.xsd ================
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.roche.com/dss/advent"  targetNamespace="http://www.roche.com/dss/advent" >
  <xs:element name="test" type="T_test">
    <xs:key name="test_key">
      <xs:selector xpath="value"/>
      <xs:field xpath="@a"/>
      <xs:field xpath="@b"/>
    </xs:key>

    <xs:keyref name="test_keyref" refer="test_key">
      <xs:selector xpath="ref"/>
      <xs:field xpath="@x"/>
      <xs:field xpath="@y"/>
    </xs:keyref>
  </xs:element>

  <xs:complexType name="T_test">
    <xs:sequence>
      <xs:element name="value" maxOccurs="unbounded">
        <xs:complexType>
          <xs:complexContent>
            <xs:restriction base="xs:anyType">
              <xs:attribute name="a" type="xs:string" use="required"/>
              <xs:attribute name="b" type="xs:string" use="required"/>
            </xs:restriction>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="ref" maxOccurs="unbounded">
        <xs:complexType>
          <xs:complexContent>
            <xs:restriction base="xs:anyType">
              <xs:attribute name="x" type="xs:string" use="required"/>
              <xs:attribute name="y" type="xs:string" use="required"/>
            </xs:restriction>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema> 
==============================================================

I don't know neither if this worked in previous releases of Xerces.

> Identity-constraint validation with multiple fields is incorrect when namespaces are used
> -----------------------------------------------------------------------------------------
>
>          Key: XERCESJ-1040
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1040
>      Project: Xerces2-J
>         Type: Bug
>     Versions: 2.6.0, 2.6.1, 2.6.2
>     Reporter: Jakub Mendys
>     Assignee: Michael Glavassevich
>     Priority: Critical

>
> The line "<ref x="1" y="4"/>" in the sample XML file should produce an error.
> With Xerces 2.5.0 the following error is reported:
> Key 'test_keyref' with value 'ID Value: 1,ID Value:  4' not found for identity constraint of element 'test'
> 2.6.0 works like 2.6.2, so the difference is introduced between 2.5.0 and 2.6.0
> ------------------------------------------- test.xml
> <?xml version="1.0" encoding="windows-1252"?>
> <test
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:noNamespaceSchemaLocation="urn:test.xsd"
> >
>   <value a="1" b="3"/>
>   <value a="2" b="4"/>
>   <ref x="1" y="3"/>
>   <ref x="2" y="4"/>
>   <ref x="1" y="4"/>
> </test>
> ----------------------------------------------------
> ------------------------------------------- test.xsd
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:element name="test" type="T_test">
>     <xs:key name="test_key">
>       <xs:selector xpath="value"/>
>       <xs:field xpath="@a"/>
>       <xs:field xpath="@b"/>
>     </xs:key>
>     <xs:keyref name="test_keyref" refer="test_key">
>       <xs:selector xpath="ref"/>
>       <xs:field xpath="@x"/>
>       <xs:field xpath="@y"/>
>     </xs:keyref>
>   </xs:element>
>   <xs:complexType name="T_test">
>     <xs:sequence>
>       <xs:element name="value" maxOccurs="unbounded">
>         <xs:complexType>
>           <xs:complexContent>
>             <xs:restriction base="xs:anyType">
>               <xs:attribute name="a" type="xs:string" use="required"/>
>               <xs:attribute name="b" type="xs:string" use="required"/>
>             </xs:restriction>
>           </xs:complexContent>
>         </xs:complexType>
>       </xs:element>
>       <xs:element name="ref" maxOccurs="unbounded">
>         <xs:complexType>
>           <xs:complexContent>
>             <xs:restriction base="xs:anyType">
>               <xs:attribute name="x" type="xs:string" use="required"/>
>               <xs:attribute name="y" type="xs:string" use="required"/>
>             </xs:restriction>
>           </xs:complexContent>
>         </xs:complexType>
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> ----------------------------------------------------

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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