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

RE: How to use Pattern to restrict data

  • To: "Sean Zhang" <Sean.Zhang@i...>,<xml-dev@l...>
  • Subject: RE: How to use Pattern to restrict data
  • From: "Michael Rys" <mrys@m...>
  • Date: Wed, 3 Apr 2002 09:33:54 -0800
  • Thread-index: AcHZr/Wu/IUEM7z2QxSe+W0icoTB0ABhO4fA
  • Thread-topic: How to use Pattern to restrict data

xml pattern value
Check the Programming Perl book by O'Reilly for a description of the
pattern language.

Please note however, that patterns are very dangerous beasts from a data
roundtriping point of view. They are fine on the string datatype, but
using a lexical pattern to restrict a value space in my opinion should
be forbidden since the canonical representation of the value may be
incompatible with the pattern.

For example, you have a pattern on an xs:double that requires lower case
'e' and a '+' on the exponent. For example: 1.1e+10 would validate this
pattern. The canonical representation of that value will be 1.1E10 which
of course does not validate the pattern.

This is a problem for systems that store the value and not the lexical
representation. Since pattern are not reversible in the general case,
there is no way that you can specify that the canonical representation
depends on the pattern either...

Best regards
Michael

> -----Original Message-----
> From: Sean Zhang [mailto:Sean.Zhang@i...]
> Sent: Monday, April 01, 2002 11:02 AM
> To: xml-dev@l...
> Subject:  How to use Pattern to restrict data
> 
> Hi,
> 
> I'm developing an XML schema and I'm using "pattern" to restrict the
valid
> values for certain attributes.
> 
> One specific case is the phone number, I want to exclude telephone
number
> starting with 800, 888, 866, etc.  How should I do this?
> 
> I was using <pattern value="[0-9]{10}"/> so that only 10 digits will
be
> acceptable. But I cannot find a way to exclude those numbers.
> I looked on the web and cannot find a complete reference as how to use
> "pattern" and what are the possible symbols can be used in the "value"
> And what does each symbol mean.  (for example, I found some schema
with
> "?"
> in value which means optional, also there are schemas specify "*",
"|",
> etc
> in value but there are no explanation as what does each mean)
> 
> Can someone point me to a good reference with full explanation?
> 
> Thanks,
> 
> Sean
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.