You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Radosław Ceszkiel (JIRA)" <xm...@xml.apache.org> on 2009/07/26 13:45:15 UTC
[jira] Created: (XMLBEANS-412) CLONE -Pattern facet regex requires
dash - to be escaped
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
Environment: Win 2000, JDK1.5
Reporter: Radosław Ceszkiel
Fix For: Version 2
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>test@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 '\-'.
Question: Why should I have to escape the dashes??
Then escaping the dashes, you can actually get the schema to compile. But then you have a new problem. The regex does validate valid email addresses!!
So two bugs AFAIK - shouldn't need to escape slashes. Something in the regex is not recognised by xmlbeans regex parser.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[jira] Updated: (XMLBEANS-412) CLONE -Pattern facet regex requires
dash - to be escaped
Posted by "Radosław Ceszkiel (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Radosław Ceszkiel updated XMLBEANS-412:
---------------------------------------
Description:
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>test@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.
was:
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>test@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 '\-'.
Question: Why should I have to escape the dashes??
Then escaping the dashes, you can actually get the schema to compile. But then you have a new problem. The regex does validate valid email addresses!!
So two bugs AFAIK - shouldn't need to escape slashes. Something in the regex is not recognised by xmlbeans regex parser.
> 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
>
>
> 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>test@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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-412) CLONE -Pattern facet regex
requires dash - to be escaped
Posted by "Julien HENRY (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875542#action_12875542 ]
Julien HENRY commented on XMLBEANS-412:
---------------------------------------
I can confirm this is a bug in xmlbeans.
According to the spec, [A-F0-9.+-]* is a valid regular expression but xmlbean fails with:
error: pattern-regex: The regular expression '[A-F0-9.+-]*' is malformed: '-' is an invalid character range. Write '\-'.
> 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
>
>
> 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>test@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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[jira] Updated: (XMLBEANS-412) CLONE -Pattern facet regex requires
dash - to be escaped
Posted by "Radosław Ceszkiel (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Radosław Ceszkiel updated XMLBEANS-412:
---------------------------------------
Description:
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>test@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.
was:
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>test@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.
> 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
>
>
> 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>test@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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-412) CLONE -Pattern facet regex
requires dash - to be escaped
Posted by "Peter Keller (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875549#action_12875549 ]
Peter Keller commented on XMLBEANS-412:
---------------------------------------
For additional clarity (I hope):
A positive char group is:
posCharGroup ::= ( charRange | charClassEsc )+
and '\-' is a valid charClassEsc, so using '\-' is valid via the charClassEsc branch. The following four positive character groups are all valid and equivalent:
[A-F0-9.+-] ('-' is a valid charRange here)
[-A-F0-9.+] ('-' is a valid charRange here)
[A-F0-9.+\-] ('\-' is a valid charClassEsc)
[\-A-F0-9.+] ('\-' is a valid charClassEsc)
The following two negative character groups are valid and equivalent:
[^A-F0-9.+\-] ('\-' is a valid charClassEsc)
[^\-A-F0-9.+] ('\-' is a valid charClassEsc)
and the following two are invalid:
[^A-F0-9.+-] ('-' is not a valid charRange here)
[^-A-F0-9.+] ('-' is not a valid charRange here)
> 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
>
>
> 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>test@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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[jira] Updated: (XMLBEANS-412) CLONE -Pattern facet regex requires
dash - to be escaped
Posted by "Radosław Ceszkiel (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Radosław Ceszkiel updated XMLBEANS-412:
---------------------------------------
Affects Version/s: Version 2.3.1
Version 2.3
Version 2.2.1
Version 2.2
Version 2.1
> 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
>
>
> 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>test@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 '\-'.
> Question: Why should I have to escape the dashes??
> Then escaping the dashes, you can actually get the schema to compile. But then you have a new problem. The regex does validate valid email addresses!!
> So two bugs AFAIK - shouldn't need to escape slashes. Something in the regex is not recognised by xmlbeans regex parser.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[jira] Commented: (XMLBEANS-412) CLONE -Pattern facet regex
requires dash - to be escaped
Posted by "Radosław Ceszkiel (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735378#action_12735378 ]
Radosław Ceszkiel commented on XMLBEANS-412:
--------------------------------------------
The bug XMLBEANS-224 was closed as resolved. It should not be, as the 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..
> 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
> Environment: Win 2000, JDK1.5
> Reporter: Radosław Ceszkiel
> Fix For: Version 2
>
>
> 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>test@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 '\-'.
> Question: Why should I have to escape the dashes??
> Then escaping the dashes, you can actually get the schema to compile. But then you have a new problem. The regex does validate valid email addresses!!
> So two bugs AFAIK - shouldn't need to escape slashes. Something in the regex is not recognised by xmlbeans regex parser.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org