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

Re: question about regex and schema

From: <dmaze@us.ibm.com>
Date: Fri, 29 Feb 2008 16:14:23 -0500
To: xmlschema-dev@w3.org
Message-ID: <OF3FD217AF.9E76E2B3-ON852573FE.00743662-852573FE.00749615@lotus.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:13:40 UTC

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