Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6989956

Wrong error message if maxOccurs in Choice less than maxOccurs in Elements contained in the Choice

    Details

    • Subcomponent:
    • Resolved In Build:
      1.4
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        The test case

        xml_schema/msData/particles/jaxp/particlesZ005.html#particlesZ005.v

        failed during JCK runtime 7 testing for JDK 7 b112 with the message:

        Fatal Error: file:/export/JCK/JCK-runtime-7/tests/xml_schema/msData/particles/particlesZ005.xml(1,111): Current configuration of the parser doesn't allow a maxOccurs attribute value to be set greater than the value 5,000.
        STATUS:Failed.Fatal Error: file:/export/JCK/JCK-runtime-7/tests/xml_schema/msData/particles/particlesZ005.xml(1,111): Current configuration of the parser doesn't allow a maxOccurs attribute value to be set greater than the value 5,000.

        This is wrong message due to the schema doesn't contains maxOccurs attribute value greater than the value 5,000.

        XSD schema:

        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

          <xsd:simpleType name="u1">
                <xsd:union>
                  <xsd:simpleType>
                    <xsd:restriction base='xsd:nonNegativeInteger'/>
                  </xsd:simpleType>
                  <xsd:simpleType>
                    <xsd:restriction base='xsd:string'>
                      <xsd:enumeration value='x'/>
                      <xsd:enumeration value='y'/>
                    </xsd:restriction>
                  </xsd:simpleType>
                </xsd:union>
          </xsd:simpleType>

          <xsd:simpleType name="u3">
                <xsd:restriction base="u1">
                      <xsd:enumeration value='x'/>
                      <xsd:enumeration value='y'/>
                      <xsd:enumeration value='1'/>
                </xsd:restriction>
          </xsd:simpleType>

          <xsd:element name="root">
            <xsd:complexType>
                <xsd:choice maxOccurs="40">
                        <xsd:element name="c" type="u3" minOccurs="0" maxOccurs="100"/>
                </xsd:choice>
            </xsd:complexType>
          </xsd:element>



        </xsd:schema>

        Corresponding XML file:
        <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="particlesZ005.xsd">
          <c>1</c>
          <c>x</c>
          <c>y</c>
        </root>



        The issues here is the value of the maxOccurs attribute in the xsd:element contained in the xsd:choice group is grater than the value of the maxOccurs in the xsd:choice.

        If set the following:
                <xsd:choice maxOccurs="40">
                        <xsd:element name="c" type="u3" minOccurs="0" maxOccurs="40"/>
                </xsd:choice>
        or the following:
                <xsd:choice maxOccurs="100">
                        <xsd:element name="c" type="u3" minOccurs="0" maxOccurs="100"/>
                </xsd:choice>
        the test passes.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  joehw Joe Wang
                  Reporter:
                  afomin Alexander Fomin (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: