W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

RE: Patterns and Decimal

From: Paul Warren <pdw@decisionsoft.com>
Date: 27 Feb 2003 15:27:58 +0000
To: Anli Shundi <ashundi@tibco.com>
Cc: "'daniella d'" <daneladg@yahoo.co.uk>, xmlschema-dev@w3.org
Message-Id: <1046359678.4267.43.camel@tobol.dsl.local>
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 Warren, Client Services           DecisionSoft Limited
+44-1865-203192                        http://www.decisionsoft.com

<xsd:schema elementFormDefault='qualified' attributeFormDefault='unqualified' targetNamespace='http://test' xmlns='http://test' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
  <xsd:element name='foo'>
        <xsd:element name='bar' maxOccurs='unbounded'>
            <xsd:restriction base='xsd:decimal'>
              <xsd:totalDigits value='11' />
              <xsd:fractionDigits value='3' />
              <xsd:pattern value='[0-9][.][0-9]*' />
              <xsd:pattern value='[1-9][0-9]*[.][0-9]*' />
              <xsd:pattern value='[1-9][0-9]*' />

Received on Thursday, 27 February 2003 10:28:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:09 UTC