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

Re: Challenge: create xPath 2.0 regular expressions fo

Subject: Re: Challenge: create xPath 2.0 regular expressions for each XML Schema datatype
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 18 Oct 2006 14:02:29 +0200
regexp for byte
David Carlisle wrote:
Most of those are already listed in the schema spec eg
http://www.w3.org/TR/xmlschema-2

    <xs:restriction base="xs:short">
      <xs:minInclusive value="-128" id="byte.minInclusive"/>
      <xs:maxInclusive value="127" id="byte.maxInclusive"/>

tells you immediately that the xpath2 for byte is

(:whatever you have for xs:short:) and $value >= -128 and $value <= 127

But he was thinking of a regular expression. Though it seems a bit outrageous to create a regex for a byte, it might look something like this:


regex = "^\s*(([+-]?(1[01]\d|12[0-7]|0?\d?\d))|+?128)\s*$"

Note that this regex does not allow for an empty string (which is correct, as xs:byte('') would fail)

-- Abel Braaksma
  http://www.nuntia.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
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-2013 All Rights Reserved.