newbie xml xsd modelling problem

Discussion in 'XML' started by Tis Veugen, Apr 3, 2005.

  1. Tis Veugen

    Tis Veugen Guest

    Hi,
    I have a modelling problem that I would like to make clear with these
    xml-file and xsd-file.

    The xsd-file:

    <xsd:simpleType name="st1">
    <xsd:restriction base="xsd:NMTOKEN">
    <xsd:enumeration value="v1"/>
    <xsd:enumeration value="v2"/>
    <xsd:enumeration value="v3"/>
    </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ct1">
    <xsd:choice>
    <xsd:sequence>
    <xsd:attribute name="type" type="st1" fixed="v1"/>
    <xsd:element name="str" type="string"/>
    </xsd:sequence>
    <xsd:sequence>
    <xsd:element name="str" type="string"/>
    </xsd:sequence>
    <xsd:sequence>
    <xsd:attribute name="type" type="st1"/>
    </xsd:sequence>
    </xsd:choice>
    </xsd:complexType>

    <xsd:element name="my_ct" type="ct1"/>

    The xml-file:

    <my_ct type="v1">
    <str> my other data </str>
    </my_ct>

    <my_ct>
    <str> my data </str>
    </my_ct>

    <my_ct type="v2">
    </my_ct>

    <my_ct type="v3">
    </my_ct>

    PROBLEM:
    How to prevent that the following lines would be allowed, according to the
    3rd choice :
    <my_ct type="v1">
    </my_ct>
    So, how should the xsd file look like?

    Thanx,
    Tis Veugen
     
    Tis Veugen, Apr 3, 2005
    #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,161
    Markus
    Nov 22, 2005
  2. Matt
    Replies:
    3
    Views:
    37,297
    MKNDK
    Sep 11, 2008
  3. stiank81
    Replies:
    4
    Views:
    15,490
    stiank81
    Jun 26, 2005
  4. Rushi
    Replies:
    1
    Views:
    575
  5. Replies:
    0
    Views:
    575
Loading...

Share This Page