RE: Patterns and Decimal

I think the regular expressions should be rewritten
to escape the dot, i.e.

  <xsd:pattern value = "[0-9][\.][0-9]*"/> 
  <xsd:pattern value = "[1-9][0-9]*[\.][0-9]*"/>
  <xsd:pattern value = "[1-9][0-9]*"/>

If the dot is unescaped it matches any character,
thus "[0-9][.][0-9]*" matches 0123.

-Anli
Anli Shundi
TIBCO Software Inc.
www.tibco.com

> -----Original Message-----
> From: Paul Warren [mailto:pdw@decisionsoft.com]
> Sent: Thursday, February 27, 2003 10:28 AM
> To: Anli Shundi
> Cc: 'daniella d'; xmlschema-dev@w3.org
> Subject: RE: Patterns and Decimal
> 
> 
> On Thu, 2003-02-27 at 15:07, Anli Shundi wrote:
> > See [1]: multiple patterns at the same type are interpreted as 
> > multiple OR branches.
> 
> Yes. So given:
> 
>  <xsd:pattern value = "[0-9][.][0-9]*"/> 
>  <xsd:pattern value = "[1-9][0-9]*[.][0-9]*"/>
>  <xsd:pattern value = "[1-9][0-9]*"/>
> 
> 0123 is not valid according to any of the above patterns.
> 
> daniella d [mailto:daneladg@yahoo.co.uk] wrote:
> 
> >         Hi, 
> >         
> >         What you have written is exactly what I expect it to do. It
> >         does it all fine apart from the third pattern. It doesn't
> >         produce an error when I enter "0123". It seems to 
> be ignoring
> >         it. 
> 
> I don't see how that is related to the 3rd pattern any more than the
> other 2.  0123 is not valid according to any of the 3 patterns.
> 
> >         I am using Xerces 2.3.0. I've tried writing them in 
> different
> >         ways but I can't get all three patterns to work together.  
> 
> I've tried the above using Xerces-J 1.4.4, Xerces-J 2 
> (version 2.0.1, I
> think) and Xerces-C.  Works as expected on all of them.
> 
> I attach my test example and schema.
> 
> Paul
> -- 
> Paul Warren, Client Services           DecisionSoft Limited
> +44-1865-203192                        http://www.decisionsoft.com
> 

Received on Thursday, 27 February 2003 10:48:48 UTC