Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1983

inconsistent/erroneous validation of maxoccurs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.1
    • None
    • SAX/SAX2
    • None

    Description

      if i parse the following xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <State>
      <testsub>123456</testsub>
      <testsub2>123456</testsub2>
      </State>

      with the XSD:
      <?xml version="1.0" encoding="utf-8"?>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="State" type="StateType" />
      <xsd:complexType name="StateType">
      <xsd:sequence>
      <xsd:element minOccurs="0" maxOccurs="1" name="testsub" type="xsd:nonNegativeInteger"/>
      <xsd:element minOccurs="0" maxOccurs="0" name="testsub2" type="xsd:nonNegativeInteger"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>

      An error is generated:
      Message: element 'testsub2' is not allowed for content model

      whereas the XSD:
      <?xml version="1.0" encoding="utf-8"?>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="State" type="StateType" />
      <xsd:complexType name="StateType">
      <xsd:sequence>
      <xsd:element minOccurs="0" maxOccurs="0" name="testsub" type="xsd:nonNegativeInteger"/>
      <xsd:element minOccurs="0" maxOccurs="1" name="testsub2" type="xsd:nonNegativeInteger"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>

      does not generate an error

      NB: xerces 2.7 doe never generates an error

      this is easilly reproduced with the sample code in xerces-c-3.1.1/samples/src/PParse

      Attachments

        Activity

          People

            Unassigned Unassigned
            reiniervos Reinier vos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: