aizu-m opened a new pull request, #145:
URL: https://github.com/apache/poi-xmlbeans/pull/145

   Differential run of one schema and one set of documents through XmlBeans and 
the JDK's Xerces validator, pattern facet on `xs:string`:
   
       DISAGREE [pattern \W+] xmlbeans=true xerces=false
          xml: <t:e>+</t:e>
          xe: cvc-pattern-valid: Value '+' is not facet-valid with respect to 
pattern '\W+' for type 'T'.
       DISAGREE [pattern [^\w]+] xmlbeans=true xerces=false
          xml: <t:e>Dž</t:e>
       DISAGREE [pattern \w+] xmlbeans=false xerces=true
          xml: <t:e>ſ</t:e>
   
   Found while auditing the pattern facet for values an instance can slip past. 
The run produced 63 disagreements where XmlBeans accepts and Xerces rejects, 
and 67 the other way round. Every one of them is on `\w`, `\W` or `[^\w]`. The 
other escapes agree.
   
   XML Schema Part 2, Appendix F, defines `\w` as 
`[#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]`: every character that is not punctuation, 
a separator or "other". `ParserForXMLSchema.getRange` builds `xml:isWord` from 
the XML 1.0 `Letter` and `Digit` tables instead. Those are Unicode 2.0 name 
characters. So symbols (`+`, `^`, `|`, `$`), combining marks, letter numbers 
(`Ⅷ`), titlecase letters (`Dž`) and letters added after Unicode 2.0 (`ſ`, `ff`) 
sit outside `\w`. A facet written with `\W` or `[^\w]` accepts them and one 
written with `\w` rejects them. Only schema mode (option `X`, which is what 
pattern facets use) is affected. Xerces corrected the same port in 2.12.0 
(XERCESJ-1651).
   
   The fix mirrors Xerces: `\W` is the union of the `P`, `Z` and `C` category 
tokens the class already has, and `\w` is its complement. `\d`, `\s`, `\i`, 
`\c` and the Perl-mode word class are untouched. With the change the 
differential run has no remaining `\w` disagreement. Regression test added to 
`RegularExpressionTest`; it fails before the change and passes after. 
`./gradlew test` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to