Thanks for updating us on this.  Certainly the pattern facet could be used
in this case where it is only a pattern match.  But with more complex
examples you may need to select between patterns match based on some
condition.  My concern was is this a regex processing issue in the
validator? So I chose to report it.  Especially since SaxonEE does validate
it.

Cheers,
Tim



On Sat, Jul 26, 2014 at 5:17 AM, Mukul Gandhi (JIRA) <
[email protected]> wrote:

>
>     [
> https://issues.apache.org/jira/browse/XERCESJ-1640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14075301#comment-14075301
> ]
>
> Mukul Gandhi commented on XERCESJ-1640:
> ---------------------------------------
>
> If the requirement is to validate strings like 111-111-1111 (or perhaps
> any string. I won't go far as saying every string) with XSD, it seems to me
> using <pattern> facet would be more appropriate. The following <pattern>
> facet works for the example posted, <xs:pattern
> value="[0-9]{3}-[0-9]{3}-[0-9]{4}"/>.
>
> fn:matches function does allow us to use an element node directly and take
> its string value by atomization. If that's how you intend to have string
> values, then fn:matches has a valid use case. I feel, using fn:matches is
> more appropriate if XPath 2.0 is used in a non XSD environment like XSLT,
> XQuery etc.
>
> Having said these, I suspect our implementation of fn:matches may have a
> certain bug pertinent to an example you've provided. The psychopath xpath2
> engine closely uses the JDK Regex implementation, and adds certain behavior
> over it to comply with the specification of fn:matches function. When I
> study our implementation of fn:matches, I feel we need to retain the
> current implementation and solve bugs (if any) over it, since the current
> implementation is fairly good and also passes the XSD 1.1 test suite.
>
> But I'll have this bug report open, and right action taken after more
> analysis.
>
> > Regex in asserts fails to validate.
> > -----------------------------------
> >
> >                 Key: XERCESJ-1640
> >                 URL: https://issues.apache.org/jira/browse/XERCESJ-1640
> >             Project: Xerces2-J
> >          Issue Type: Bug
> >          Components: JAXP (javax.xml.validation), XML Schema 1.1
> Datatypes, XML Schema 1.1 Structures
> >    Affects Versions: 2.11.0
> >         Environment: Ubuntu 14.04
> >            Reporter: Timothy Cook
> >              Labels: assertion, validation
> >
> > I am quite certain this worked in a previous version.
> > cvc-assertion: Assertion evaluation ('matches(DvString-dv,
> '[0-9]{3}-[0-9]{3}-[0-9]{4}')') for element
> 'ccd:el-06bf2593-dd8a-4681-a6e5-0470134e632b' on schema type
> 'ct-06bf2593-dd8a-4681-a6e5-0470134e632b' did not succeed.
> > Severity
> > Error
> > The above assert doesn't validate this string:
> > <DvString-dv>111-111-1111</DvString-dv>
> > SaxonEE does validate it.  These are both the shipped validators with
> oXygen 16.0
> > Interestingly this assert:
> > <xs:assert test="matches(DvString-dv, '^\d{5}([\-]?\d{3})$')"/>
> > does validate this string:
> > <DvString-dv>99999-000</DvString-dv>
> > There are other examples of these asserts here:
> > https://github.com/mlhim/tb
> >
> >
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.2#6252)
>



-- 

============================================
Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

Reply via email to