W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2007

Re: xs:string range 1 to 999

From: Pete Cordell <petexmldev@tech-know-ware.com>
Date: Wed, 9 May 2007 13:01:53 +0100
Message-ID: <001701c79231$d9c026d0$4200a8c0@Codalogic>
To: "Markus Gamperl" <markus.gamperl@gmx.at>, <xmlschema-dev@w3.org>

Hi Markus,

You could try:

<xs:pattern value="[1-9][0-9]{0,2}"/>

I've used [0-9] instead of \d because \d includes numbers from a whole bunch 
of different alphabets that I'm guessing you don't want.  (This 'feature' is 
really a pattern matching/Unicode issue rather than a schema issue.)

BTW - why don't you want to use an integer type?

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML Schema to C++ data binding visit
 http://www.tech-know-ware.com/lmx/
 http://www.codalogic.com/lmx/
=============================================

----- Original Message ----- 
From: "Markus Gamperl" <markus.gamperl@gmx.at>
To: <xmlschema-dev@w3.org>
Sent: Wednesday, May 09, 2007 12:08 PM
Subject: xs:string range 1 to 999


>
> Dear experts!
>
> Do you have an idea how to define a xs:string with the range from 1 to 
> 999?
>
> I tried the following:
> <xs:simpleType name="type1-999">
> <xs:restriction base="xs:string">
> <xs:pattern value="\d{1,3}"/>
> </xs:restriction>
> </xs:simpleType>
>
> But in my configuration the value 0 is allowed - but I don't want to allow 
> value 0 - du you have an idea?
>
> Thanks
> Markus
> -- 
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
>
> 
Received on Wednesday, 9 May 2007 12:02:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:59 GMT