[ 
https://issues.apache.org/jira/browse/DAFFODIL-2877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17821840#comment-17821840
 ] 

Mike Beckerle commented on DAFFODIL-2877:
-----------------------------------------

That's a {*}_great idea_{*}: tolerate the pattern, so that XSD validators can 
use it. 

There are a number of things that DFDL disallows, that would be useful for it 
to ignore rather than error about. 

Another is key/unique constraints - I mean why not allow those so that an XSD 
validator can enforce them (or even Xerces J that we build into Daffodil for 
"full" validation)

In general, I suggest we should allow any facets that XSD allows, on this 
principle that we ignore them in Daffodil (and warn about that), but allow them 
to exist for XSD validation. 

> Allow pattern restriction facet to be used on non-string types
> --------------------------------------------------------------
>
>                 Key: DAFFODIL-2877
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2877
>             Project: Daffodil
>          Issue Type: New Feature
>          Components: Back End, Front End
>            Reporter: Steve Lawrence
>            Priority: Major
>
> Section 5.2 of the DFDL specification says that the pattern restriction facet 
> can only be used for xs:string types. Daffodil currently implements this 
> limitation.
> However, there are a number of cases where a pattern is the only way to 
> correctly restrict the value of non-string types, such as xs:long. 
> One example is a number that can only be between 100 and 300 but in multiples 
> of 5. In that case, a pattern like this would work:
> {code}
> <xs:pattern value="([12][0-9][05])|([300])" />
> {code}
> Another example could be apartment rooms, where the first digit represents 
> the floor (e.g. 1-5), and the second two digits represent the room number 
> between 1 and 15 (assuming 15 rooms per floor). In that case, the pattern 
> restriction might be:
> {code}
> <xs:pattern value="[1-5]((0[1-9])|(1[0-5]))" />
> {code}
> The patterns are often going to be a bit ugly, but in some cases it's the 
> only way to correctly validate numbers using only XML Schema capabilities.
> Note that only supporting pattern on xs:string types is a limitation imposed 
> by DFDL--XML schema allows pattern restriction on all types. We should remove 
> this limitation and allow pattern facet to be used on all types.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to