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 2002/07/04 12:46:22 UTC

DO NOT REPLY [Bug 10474] New: - minOccurs/maxOccurs not working in all cases

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=10474>.
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=10474

minOccurs/maxOccurs not working in all cases

           Summary: minOccurs/maxOccurs not working in all cases
           Product: Xerces2-J
           Version: 2.0.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: rahul.srivastava@sun.com


minOccurs/maxOccurs constraint is not always enforced. In the following schema,
I have minOccurs=4 and maxOccurs=7 for element 'child'. In the instance file, I
have only two 'child's. Now, when I validate, I get no error, unless I change
maxOccurs to 6.

test.xsd:
---------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="foo" 
            xmlns="foo" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="unqualified">

  <xsd:element name="root">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="child" type="xsd:string" minOccurs="4"
maxOccurs="7"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  
</xsd:schema>

test.xml:
---------
<?xml version="1.0" ?>
<pfx:root xmlns:pfx="foo"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="foo test.xsd">

  <child>first</child>
  <child>second</child>

</pfx:root>

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