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 bu...@apache.org on 2003/02/03 00:24:21 UTC

DO NOT REPLY [Bug 16683] New: - Wrong validation check on constraint built of 2 fields.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16683>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16683

Wrong validation check on constraint built of 2 fields.

           Summary: Wrong validation check on constraint built of 2 fields.
           Product: Xerces2-J
           Version: 2.0.2
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: XML Schema datatypes
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: mikael_s@bezeqint.net


I have a schema that use unique/keys & keyref. One of the unique constraint is 
compund of 2 fields. 
When more than one valid entry is inserted the validation fails, it should be 
like that.
-----------------------------
The schema is:
-----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by Mikael S -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="purchaseReport">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="regions" type="RegionsTypes">
          <!--
          <xs:keyref name="dummy2" refer="pNumKey">
            <xs:selector xpath="zip/part"/>
            <xs:field xpath="@number"/>
          </xs:keyref>
          -->
        </xs:element>
        <xs:element name="parts" type="PartsType"/>
      </xs:sequence>
      <xs:attribute name="period" type="xs:duration"/>
      <xs:attribute name="periodEnding" type="xs:date"/>
    </xs:complexType>
    <xs:unique name="dummy1">
      <xs:selector xpath="./regions/zip"/>
      <xs:field xpath="@code"/>
      <xs:field xpath="part/@number"/>
    </xs:unique>
    <!--
    <xs:key name="pNumKey">
      <xs:selector xpath="parts/part"/>
      <xs:field xpath="@number"/>
    </xs:key>
    -->
  </xs:element>
  <xs:complexType name="RegionsTypes">
    <xs:sequence>
      <xs:element name="zip" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="part" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="number" type="xs:string"/>
                <xs:attribute name="quantity" type="xs:positiveInteger"/>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="code" type="xs:positiveInteger"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="PartsType">
    <xs:sequence>
      <xs:element name="part" maxOccurs="unbounded">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="number" type="xs:string"/>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
-------------------------------------------------------
The xml is 
-------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<purchaseReport period="-P1Y" periodEnding="1999-12-31" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="D:\_dev\_et\dev\sources\amdocs\et\properties\adv
anced.xsd">
  <regions>
    <zip code="95819">
      <part number="872-AA" quantity="1"/>
      <part number="926-AA" quantity="1"/>
      <part number="833-AA" quantity="1"/>
      <part number="455-BX" quantity="1"/>
    </zip>
    <zip code="63143">
      <part number="455-BX" quantity="4"/>
    </zip>
  </regions>
  <parts>
    <part number="872-AA">Lawnmower</part>
    <part number="926-AA">Baby Monitor</part>
    <part number="833-AA">Lapis Necklace</part>
    <part number="455-BX">Sturdy Shelves</part>
  </parts> 
</purchaseReport>

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