Newbe question

  • Thread starter Kjell-Ake Karlsson
  • Start date
K

Kjell-Ake Karlsson

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
 
K

Klaus Johannes Rusch

Kjell-Ake Karlsson said:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top