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

length, maxLength, and minLength facets are applied to item instead of list when value specific via default/fixed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.0
    • 2.8.0
    • None
    • any

    Description

      Consider the following scheme:

      <?xml version="1.0" encoding="utf-8"?>
      <schema xmlns="http://www.w3.org/2001/XMLSchema"
      xmlns:t="test"
      targetNamespace="test"
      elementFormDefault="qualified">

      <simpleType name="ListOfInts">
      <list itemType="int"/>
      </simpleType>

      <simpleType name="int3">
      <restriction base="t:ListOfInts">
      <minLength value="3"/>
      <maxLength value="3"/>
      </restriction>
      </simpleType>

      <element name="root" type="t:int3" default="0 0 0"/>

      </schema>

      and instance:

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

      Processing with dom_count results in the following error:

      $ ./dom_count -v=always -n -s test.xml

      Error at file /tmp/test.xsd, line 22, char 53
      Message: Value '0' with length '1' is not equal to length facet of '3'

      Seems like the validator applies minLength and maxLength facets to individual list items instead of to the list as a whole. This is also the case for the length facet and the fixed attribute instead of default. Interestingly, if we remove the default attribute from the schema everyhting works fine, even though the instance contains exactly the same value as the default attribute.

      Attachments

        Issue Links

          Activity

            People

              dbertoni David N Bertoni
              bsk Boris Kolpackov
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: