XML Schema newbie question

Discussion in 'XML' started by Kevin B Ebert, Jan 30, 2004.

  1. I have the following xml document that I want to create a schema for:

    <?xml version="1.0" encoding="utf-8" ?>
    <CheckPoints xmlns="http://tempuri.org/WorkflowManager">
    <CheckPoint id="uniqueID">
    <case value="value1" actiontype="HOLD" action="action1" />
    <case value="value1" actiontype="STATUS" action="action2" />
    <case value="value1" actiontype="CLASS" action="action3" />
    <case value="value1" actiontype="URL" action="action4" />
    </CheckPoint>
    </CheckPoints>

    I want to develop a schema document that will limit the values for
    "actiontype" to HOLD, STATUS, CLASS, or URL. Because I'm a newbie to
    schema document creation, I used the schema generator within Visual
    Studio. It generated the following schema:

    <?xml version="1.0"?>
    <xs:schema id="CheckPoints"
    targetNamespace="http://tempuri.org/WorkflowManager"
    xmlns:mstns="http://tempuri.org/WorkflowManager"
    xmlns="http://tempuri.org/WorkflowManager"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
    attributeFormDefault="qualified" elementFormDefault="qualified">
    <xs:element name="CheckPoints" msdata:IsDataSet="true"
    msdata:EnforceConstraints="False">
    <xs:complexType>
    <xs:choice maxOccurs="unbounded">
    <xs:element name="CheckPoint">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="case" minOccurs="0"
    maxOccurs="unbounded">
    <xs:complexType>
    <xs:attribute name="value" form="unqualified"
    type="xs:string" />
    <xs:attribute name="actiontype" form="unqualified"
    type="xs:string" />
    <xs:attribute name="action" form="unqualified"
    type="xs:string" />
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="id" form="unqualified"
    type="xs:string" />
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>

    Thanks for the help in advance.
     
    Kevin B Ebert, Jan 30, 2004
    #1
    1. Advertising

  2. Kevin B Ebert

    George Bina Guest

    Hi Kevin,

    ....
    > I want to develop a schema document that will limit the values for
    > "actiontype" to HOLD, STATUS, CLASS, or URL.

    ....
    > <xs:attribute name="actiontype" form="unqualified"
    > type="xs:string" />


    You can use a restriction as below:

    <xs:attribute name="actiontype" form="unqualified">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="HOLD"/>
    <xs:enumeration value="STATUS"/>
    <xs:enumeration value="CLASS"/>
    <xs:enumeration value="URL"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>

    Best Regards,
    George
    -------------------------------------------------------------
    George Cristian Bina mailto:
    <oXygen/> XML Editor - http://www.oxygenxml.com/
     
    George Bina, Jan 30, 2004
    #2
    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,637
    Markus
    Nov 23, 2005
  2. Fred Smith
    Replies:
    1
    Views:
    980
    Martin Honnen
    Feb 5, 2004
  3. Hari Om
    Replies:
    1
    Views:
    475
    Martin SChukrazy
    Mar 2, 2004
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,312
    Stanimir Stamenkov
    Apr 25, 2005
  5. Replies:
    3
    Views:
    3,071
Loading...

Share This Page