![]() |
|
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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/ |
|