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

Jerry Sy updated XMLBEANS-412:
------------------------------

    Attachment: ParserForXMLSchema.java
                xmlbeans-412.patch

Suggested fix to allow unescaped '-' at start or end of a positive char group.
                
> CLONE -Pattern facet regex requires dash - to be escaped
> --------------------------------------------------------
>
>                 Key: XMLBEANS-412
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-412
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: Validator
>    Affects Versions: Version 2, Version 2.1, Version 2.2, Version 2.2.1,  
> Version 2.3,  Version 2.3.1
>         Environment: Win 2000, JDK1.5
>            Reporter: Radosław Ceszkiel
>             Fix For: Version 2
>
>         Attachments: ParserForXMLSchema.java, xmlbeans-412.patch
>
>
> Given the following xsd  that should allow only a valid email address pattern:
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>   <xsd:element name="Email" type="EmailType" />
>   <xsd:simpleType name="EmailType" >
>     <xsd:restriction base="xsd:token">
>       <xsd:pattern 
> value="([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(([a-zA-Z0-9_-])*\.([a-zA-Z0-9_-])+)+"/>
>     </xsd:restriction>
>   </xsd:simpleType>
> </xsd:schema>
> Using the following simple xml instance:
> <Email>t...@test.com</Email>
> Running:
> validate sample.xsd sample.xml
> generates:
> Schema invalid:
> D:\sample.xsd:7: error: pattern-regex: The regular expression 
> '([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(([a-zA-Z0-9_-])*\.([a-zA-Z0-9_-])+)+' is 
> malformed: '-' is an invalid character range. Write '\-'.
> A dash at the end or at the beginning of a character range does not have to 
> be escaped (see 
> http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#nt-charRange
>  "The - character is a valid character range only at the beginning or end of 
> a - positive character group- .") 
> The regular expression in the email example is a valid xsd regexp and should 
> be accepted by the XmlBeans validator.

--
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: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to