Newbe question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kjell-Ake Karlsson

    #1

    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
  • Klaus Johannes Rusch

    #2
    Re: Newbe question

    Kjell-Ake Karlsson wrote:
    [color=blue]
    > 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?[/color]

    <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
    KlausRusch@atme dia.net



    Comment

    Working...