NEWBIE: XML restriction query

Discussion in 'XML' started by Victor, Feb 3, 2004.

  1. Victor

    Victor Guest

    Hi, I have defined the following that limits values for <COUNTING> to
    be ONE, TWO or THREE. I want to modify it so the base isn't a string
    anymore but a long, and accept ANY long as valid, but I still want to
    accept the values ONE, TWO, or THREE. Can this be done?

    Thank you
    Victor


    <xs:simpleType name="COUNTING">
    <xs:restriction base="xs:string">
    <xs:enumeration value="ONE"/>
    <xs:enumeration value="TWO"/>
    <xs:enumeration value="THREE"/>
    </xs:restriction>
    </xs:simpleType>



    The following would be valid against a new restriction

    ONE
    TWO
    17
    65
    THREE
    ONE
    765
    861
    12
    67



    The following would be invalid
    ONE
    TWO
    FOUR
    17
    65
    THREE
    ONE
    765
     
    Victor, Feb 3, 2004
    #1
    1. Advertising

  2. Victor

    BarryNL Guest

    Victor wrote:
    > Hi, I have defined the following that limits values for <COUNTING> to
    > be ONE, TWO or THREE. I want to modify it so the base isn't a string
    > anymore but a long, and accept ANY long as valid, but I still want to
    > accept the values ONE, TWO, or THREE. Can this be done?
    >


    You could use a regular expression as the restriction, eg:
    "ONE|TWO|THREE|[1-9][0-9]+"

    > Thank you
    > Victor
    >
    >
    > <xs:simpleType name="COUNTING">
    > <xs:restriction base="xs:string">
    > <xs:enumeration value="ONE"/>
    > <xs:enumeration value="TWO"/>
    > <xs:enumeration value="THREE"/>
    > </xs:restriction>
    > </xs:simpleType>
    >
    >
    >
    > The following would be valid against a new restriction
    >
    > ONE
    > TWO
    > 17
    > 65
    > THREE
    > ONE
    > 765
    > 861
    > 12
    > 67
    >
    >
    >
    > The following would be invalid
    > ONE
    > TWO
    > FOUR
    > 17
    > 65
    > THREE
    > ONE
    > 765
     
    BarryNL, Feb 3, 2004
    #2
    1. Advertising

  3. Victor

    Victor Guest

    Thanks - so simple.
    Victor.

    BarryNL <> wrote in message news:<401f910b$0$326$4all.nl>...
    > Victor wrote:
    > > Hi, I have defined the following that limits values for <COUNTING> to
    > > be ONE, TWO or THREE. I want to modify it so the base isn't a string
    > > anymore but a long, and accept ANY long as valid, but I still want to
    > > accept the values ONE, TWO, or THREE. Can this be done?
    > >

    >
    > You could use a regular expression as the restriction, eg:
    > "ONE|TWO|THREE|[1-9][0-9]+"
    >
    > > Thank you
    > > Victor
    > >
    > >
    > > <xs:simpleType name="COUNTING">
    > > <xs:restriction base="xs:string">
    > > <xs:enumeration value="ONE"/>
    > > <xs:enumeration value="TWO"/>
    > > <xs:enumeration value="THREE"/>
    > > </xs:restriction>
    > > </xs:simpleType>
    > >
    > >
    > >
    > > The following would be valid against a new restriction
    > >
    > > ONE
    > > TWO
    > > 17
    > > 65
    > > THREE
    > > ONE
    > > 765
    > > 861
    > > 12
    > > 67
    > >
    > >
    > >
    > > The following would be invalid
    > > ONE
    > > TWO
    > > FOUR
    > > 17
    > > 65
    > > THREE
    > > ONE
    > > 765
     
    Victor, Feb 4, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RWQ=?=

    file restriction - Forms authentication

    =?Utf-8?B?RWQ=?=, May 31, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    378
    Jim Cheshire [MSFT]
    Jun 1, 2004
  2. Replies:
    1
    Views:
    444
    Stan Kitsis [MSFT]
    Dec 29, 2004
  3. Replies:
    1
    Views:
    388
    Stan Kitsis [MSFT]
    Dec 29, 2004
  4. Replies:
    3
    Views:
    474
    Henry S. Thompson
    Jan 7, 2005
  5. Replies:
    1
    Views:
    429
Loading...

Share This Page