« Return to Thread: [jira] [Created] (XERCESJ-1557) Wrong pattern validation failure

[jira] [Updated] (XERCESJ-1557) Wrong pattern validation failure

by JIRA xerces-j-dev@xml.apache.org :: Rate this Message:

| View in Thread


     [ https://issues.apache.org/jira/browse/XERCESJ-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Frei updated XERCESJ-1557:
------------------------------------

    Description:
The pattern ".+/.+/.+/.+" does not get resolved properley in Xerces-J 2.10 or 2.11 (2.9 did not cause a problem).
Note: the dot here indicates any character except \r or \n. What I would like to verify is that there are 4 parts separated with a slash ("/").

Example XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
        <xs:element name="Root">
                <xs:annotation>
                        <xs:documentation>Comment describing your root element</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="E" maxOccurs="unbounded">
                                        <xs:complexType>
                                                <xs:attribute name="ref" use="required">
                                                        <xs:simpleType>
                                                                <xs:restriction base="xs:normalizedString">
                                                                        <xs:pattern value=".+/.+/.+/.+"/>
                                                                </xs:restriction>
                                                        </xs:simpleType>
                                                </xs:attribute>
                                        </xs:complexType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>

Example file wrongly indicating errors:

<Root xsi:noNamespaceSchemaLocation="Ref.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <E ref="S12/D1/Q1/L1"/>
        <E ref="S12/E1/Q4/B1"/>
</Root>

Errors produced by Xerces-J:

[Error] Ref.xml:3:25: cvc-pattern-valid: Value 'S12/D1/Q1/L1' is not facet-valid with respect to pattern '.+/.+/.+/.+' for type '#AnonType_refERoot'.
[Error] Ref.xml:3:25: cvc-attribute.3: The value 'S12/D1/Q1/L1' of attribute 'ref' on element 'E' is not valid with respect to its type, '#AnonType_refERoot'.
[Error] Ref.xml:4:25: cvc-pattern-valid: Value 'S12/E1/Q4/B1' is not facet-valid with respect to pattern '.+/.+/.+/.+' for type '#AnonType_refERoot'.
[Error] Ref.xml:4:25: cvc-attribute.3: The value 'S12/E1/Q4/B1' of attribute 'ref' on element 'E' is not valid with respect to its type, '#AnonType_refERoot'.
Ref.xml: 191 ms (3 elems, 3 attrs, 0 spaces, 5 chars)



  was:
The pattern ".+/.+/.+/.+" does not get resolved properley in Xerces-J 2.10 or 2.11 (2.9 did not cause a problem).
Note: the dot here indicates any character except \r or \n. What I would like to verify is that there are 4 parts separated with a slash ("/").

Example XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
        <!--<xs:simpleType name="tRef">
                <xs:restriction base="xs:normalizedString">
                        <xs:pattern value=".+/.+/.+/.+"/>
                </xs:restriction>
        </xs:simpleType>-->
        <xs:element name="Root">
                <xs:annotation>
                        <xs:documentation>Comment describing your root element</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="E" maxOccurs="unbounded">
                                        <xs:complexType>
                                                <xs:attribute name="ref" use="required">
                                                        <xs:simpleType>
                                                                <xs:restriction base="xs:normalizedString">
                                                                        <xs:pattern value=".+/.+/.+/.+"/>
                                                                </xs:restriction>
                                                        </xs:simpleType>
                                                </xs:attribute>
                                        </xs:complexType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>

Example file wrongly indicating errors:

<Root xsi:noNamespaceSchemaLocation="Ref.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <E ref="S12/D1/Q1/L1"/>
        <E ref="S12/E1/Q4/B1"/>
</Root>

Errors produced by Xerces-J:

[Error] Ref.xml:3:25: cvc-pattern-valid: Value 'S12/D1/Q1/L1' is not facet-valid with respect to pattern '.+/.+/.+/.+' for type '#AnonType_refERoot'.
[Error] Ref.xml:3:25: cvc-attribute.3: The value 'S12/D1/Q1/L1' of attribute 'ref' on element 'E' is not valid with respect to its type, '#AnonType_refERoot'.
[Error] Ref.xml:4:25: cvc-pattern-valid: Value 'S12/E1/Q4/B1' is not facet-valid with respect to pattern '.+/.+/.+/.+' for type '#AnonType_refERoot'.
[Error] Ref.xml:4:25: cvc-attribute.3: The value 'S12/E1/Q4/B1' of attribute 'ref' on element 'E' is not valid with respect to its type, '#AnonType_refERoot'.
Ref.xml: 191 ms (3 elems, 3 attrs, 0 spaces, 5 chars)



   

> Wrong pattern validation failure
> --------------------------------
>
>                 Key: XERCESJ-1557
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1557
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Datatypes
>    Affects Versions: 2.10.0, 2.11.0
>         Environment: Windows 7 64 bits,  java version 1.6.0_26
>            Reporter: Christian Frei
>
> The pattern ".+/.+/.+/.+" does not get resolved properley in Xerces-J 2.10 or 2.11 (2.9 did not cause a problem).
> Note: the dot here indicates any character except \r or \n. What I would like to verify is that there are 4 parts separated with a slash ("/").
> Example XSD:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:element name="Root">
> <xs:annotation>
> <xs:documentation>Comment describing your root element</xs:documentation>
> </xs:annotation>
> <xs:complexType>
> <xs:sequence>
> <xs:element name="E" maxOccurs="unbounded">
> <xs:complexType>
> <xs:attribute name="ref" use="required">
> <xs:simpleType>
> <xs:restriction base="xs:normalizedString">
> <xs:pattern value=".+/.+/.+/.+"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> Example file wrongly indicating errors:
> <Root xsi:noNamespaceSchemaLocation="Ref.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <E ref="S12/D1/Q1/L1"/>
> <E ref="S12/E1/Q4/B1"/>
> </Root>
> Errors produced by Xerces-J:
> [Error] Ref.xml:3:25: cvc-pattern-valid: Value 'S12/D1/Q1/L1' is not facet-valid with respect to pattern '.+/.+/.+/.+' for type '#AnonType_refERoot'.
> [Error] Ref.xml:3:25: cvc-attribute.3: The value 'S12/D1/Q1/L1' of attribute 'ref' on element 'E' is not valid with respect to its type, '#AnonType_refERoot'.
> [Error] Ref.xml:4:25: cvc-pattern-valid: Value 'S12/E1/Q4/B1' is not facet-valid with respect to pattern '.+/.+/.+/.+' for type '#AnonType_refERoot'.
> [Error] Ref.xml:4:25: cvc-attribute.3: The value 'S12/E1/Q4/B1' of attribute 'ref' on element 'E' is not valid with respect to its type, '#AnonType_refERoot'.
> Ref.xml: 191 ms (3 elems, 3 attrs, 0 spaces, 5 chars)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@...
For additional commands, e-mail: j-dev-help@...

 « Return to Thread: [jira] [Created] (XERCESJ-1557) Wrong pattern validation failure