Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML Schema newbie question

Reply
Thread Tools

XML Schema newbie question

 
 
Kevin B Ebert
Guest
Posts: n/a
 
      01-30-2004
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"
xmlnss="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-comml-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.
 
Reply With Quote
 
 
 
 
George Bina
Guest
Posts: n/a
 
      01-30-2004
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 (E-Mail Removed)
<oXygen/> XML Editor - http://www.oxygenxml.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema huntingseasonson@gmail.com Perl Misc 5 11-29-2006 12:37 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
XML Schema to XML Schema Conversion Hari Om XML 1 03-02-2004 09:04 PM
XML schema regular expressions question and recommended XML Schema book Fred Smith XML 1 02-05-2004 11:12 AM



Advertisments