conditional restriction in schema?

Discussion in 'XML' started by Andrew L, Jan 28, 2004.

  1. Andrew L

    Andrew L Guest

    Hello all,

    I'm new to XML schema design, and I've got a problem which I need some help
    with. I have a simple type which describes a list of valid categories. I
    also have another type which describes a list of all known subcategories.
    However only a subset of the subcategories will be valid and this depends
    on the value of the main category.
    eg If category is cat1, then the only valid subcategories are scat1, scat2.
    How and where can I put in a conditional operator in my schema?

    <xs:simpleType name="category">
    <xs:restriction base="xs:NMTOKEN">
    <xs:enumeration value="cat1"/>
    <xs:enumeration value="cat2"/>
    <xs:enumeration value="cat3"/>
    </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="category">
    <xs:restriction base="xs:NMTOKEN">
    <xs:enumeration value="scat1"/>
    <xs:enumeration value="scat2"/>
    <xs:enumeration value="scat3"/>
    <xs:enumeration value="scat4"/>
    <xs:enumeration value="scat5"/>
    </xs:restriction>
    </xs:simpleType>

    Many thanks for your help

    Andrew
    Andrew L, Jan 28, 2004
    #1
    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. Markus
    Replies:
    1
    Views:
    1,530
    Markus
    Nov 23, 2005
  2. Andy Howden
    Replies:
    0
    Views:
    503
    Andy Howden
    Oct 20, 2003
  3. Replies:
    1
    Views:
    443
    Stan Kitsis [MSFT]
    Dec 29, 2004
  4. Replies:
    1
    Views:
    386
    Stan Kitsis [MSFT]
    Dec 29, 2004
  5. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,251
    Stanimir Stamenkov
    Apr 25, 2005
Loading...

Share This Page