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

Validator incorrectly interprets an empty regex pattern

XMLWordPrintable

    • 1.4
    • generic
    • generic
    • Verified

        Attached a group of invalid test cases (schema + xml document). Validator interprets all of them as valid pairs.
        Example of schema:
        <xsd:element name="doc">
            <xsd:complexType>
                    <xsd:choice>
                        <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
                    </xsd:choice>
            </xsd:complexType>
        </xsd:element>

        <xsd:simpleType name="Regex">
               <xsd:restriction base="xsd:string">
                   <xsd:pattern value=""/>
               </xsd:restriction>
        </xsd:simpleType>

        The following xml document is valid for this schema:

        <?xml version="1.0"?>
        <doc xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance&#39;
            xsi:noNamespaceSchemaLocation='reA2.xsd' >

        <!--
        base='string', pattern='', value='a', type='invalid', RULE='1'
        -->

             <elem>a</elem>

         </doc>

              joehw Joe Wang
              lkuskov Leonid Kuskov
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: