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

Re: xs:string range 1 to 999

From: George Cristian Bina <george@oxygenxml.com>
Date: Wed, 09 May 2007 15:11:21 +0300
Message-ID: <4641BA69.7010200@oxygenxml.com>
To: Markus Gamperl <markus.gamperl@gmx.at>
Cc: xmlschema-dev@w3.org

Hi Markus,

If you have multiple pattern facets then any of them should match, so 
you can write:

<xs:simpleType name="type1-999">
   <xs:restriction base="xs:string">
     <xs:pattern value="[1-9]"/>
     <xs:pattern value="[1-9][0-9]"/>
     <xs:pattern value="[1-9][0-9][0-9]"/>
   </xs:restriction>
</xs:simpleType>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Markus Gamperl wrote:
> 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
Received on Wednesday, 9 May 2007 12:11:34 GMT

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