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

Re: question about regex and schema

From: Andreas Peter <info@minimag.de>
Date: Fri, 29 Feb 2008 22:20:11 +0100
Message-ID: <20080229222011.9av5ywaes8s8c0o0@ssl.lunabox.de>
To: xmlschema-dev@w3.org

Thanks David,

I mixed up xs:enumeration an xs:pattern :-(

Andreas


Quoting dmaze@us.ibm.com:

> Andreas Peter <info@minimag.de> wrote on 02/29/2008 04:00:34 PM:
>
>>              <xs:element name="greek">
>>                  <xs:simpleType>
>>                      <xs:restriction base="xs:string">
>>                          <xs:enumeration value="\p{Greek}"/>
>>                      </xs:restriction>
>>                  </xs:simpleType>
>>              </xs:element>
>>
>> The aim should be to allow only greek characters inside an element
>> with the speccharType. But when I am going to test it inside an
>> instance document I only have the possibility to use the value
>> "\p{Greek}" instead of greek characters.
>
> Since you used <xs:enumeration> you've said "allow only xs:strings whose
> value is specifically '\p{Greek}'".  I think you were after the xs:pattern
> facet instead, e.g.
>
> <xs:pattern value="\p{IsGreek}*"/>
>
> The "*" in the pattern means "allow any number of Greek characters,
> possibly none"; without it you're allowing only a single character.  You
> also might consider \p{IsGreek}+ to require at least one character.
>
> David Maze
> Engineer, IBM WebSphere DataPower SOA Appliances
> One Rogers Street, Cambridge, MA 02142
> Phone: 617-693-1306  Fax: 617-693-5541
Received on Friday, 29 February 2008 21:20:35 GMT

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