[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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>
Re: question about regex and schema
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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.