brand-zz / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
0 stars 0 forks source link

The two provided RegexEngine implementations are NOT equivalent #192

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This regular expression

[+-]

is valid according to XSD 1.0 datatype spec 
(http://www.w3.org/TR/xmlschema-2/#nt-charClassExpr), second edition, but is 
invalid according to XSD 1.1 datatype spec 
(http://www.w3.org/TR/xmlschema11-2/#nt-charClassExpr). Each of the two 
provided com.thaiopensource.datatype.xsd.regex.RegexEngine implementations 
seems to implement one of those:
* com.thaiopensource.datatype.xsd.regex.xerces2.RegexEngineImpl (1.0)
* com.thaiopensource.datatype.xsd.regex.java.RegexEngineImpl (1.1)

This is inconsistent with what the following page claims: 
http://www.thaiopensource.com/relaxng/jing-datatypes.html

People should be warned of this somewhere. 

I just spent a couple of hours figuring out why my valid regular expression was 
being rejected when doing RelaxNG validation;
invalid parameter: invalid regular expression: character "]" must be escaped 
with "\" in ths context:
[+/->>>>] 

The solution was to rely on Xerces2 implementation, which is not the default.

I'm using the 2009 release.

Original issue reported on code.google.com by jernej.t...@gmail.com on 29 Jan 2015 at 12:35