Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Newbe question

 
Thread Tools Search this Thread
Old 07-01-2003, 12:44 PM   #1
Default Newbe question


I'm an absolute beginner to XML Schema.

I want to validate an element containing (kind of) date which looks
like this:

CCYYWW
That is:
CC: Century
YY: Year
WW: Week number (in that year, valid week numbers is 1 to 53)

Is there a way to validate such a field?
What I would like to do is to validate the first four charaters as a
gYear, and then validate WW as a number between 01 and 53.
Is this possible?

Kakan


Kjell-Ake Karlsson
  Reply With Quote
Old 07-01-2003, 02:19 PM   #2
Klaus Johannes Rusch
 
Posts: n/a
Default Re: Newbe question

Kjell-Ake Karlsson wrote:

> I want to validate an element containing (kind of) date which looks
> like this:
>
> CCYYWW
> That is:
> CC: Century
> YY: Year
> WW: Week number (in that year, valid week numbers is 1 to 53)
>
> Is there a way to validate such a field?
> What I would like to do is to validate the first four charaters as a
> gYear, and then validate WW as a number between 01 and 53.
> Is this possible?


<simpleType name='YYYYWW'>
<restriction base='string'>
<pattern value='[0-9]{4}((0[1-9])([1-4][0-9])|(5[0-3]))' />
</restriction>
</simpleType>

Four arbitrary digits, followed by
the digit 0 and a digit in the range of 1-9 (weeks 1 to 9) OR
digits 1-4 and an arbitrary digit (weeks 10-49) OR
the digit 5 and a digit in the range of 0-9 (weeks 50-53)


--
Klaus Johannes Rusch

http://www.atmedia.net/KlausRusch/


  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump