DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27949>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27949

Schema xs:pattern value does not correctly handle [-xxx] or [xxx-]

           Summary: Schema xs:pattern value does not correctly handle [-xxx]
                    or [xxx-]
           Product: Xerces2-J
           Version: 2.6.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: XML Schema datatypes
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Overall Description
Xerces-2 does not correctly handle leading or trailing - characters in 
character sets, but requires the addition of an escape character \.

Steps to reproduce
Validate the xml:
    <Test Sign="-"/>

Using the schema:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        <xs:element name="Test">
                <xs:complexType>
                        <xs:attribute name="Sign" type="Pattern" 
use="required"/>
                </xs:complexType>
        </xs:element>
        <xs:simpleType name="Pattern">
                <xs:restriction base="xs:string">
                        <xs:pattern value="[+-]"/>
                </xs:restriction>
        </xs:simpleType>
</xs:schema>

The parser gives the error "InvalidRegex: Pattern value '[+-]' is not a valid 
regular expression. The reported error was: ''-' is an invalid character range. 
Write '\-'.'.

According to http://www.w3.org/TR/xmlschema-2/#dt-charrange

"The - character is a valid character range only at the beginning or end of a 
·positive character group·."

So the - character should not need to be escaped if it is next to a square 
bracket.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to