Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > newbie xml xsd modelling problem

Reply
Thread Tools

newbie xml xsd modelling problem

 
 
Tis Veugen
Guest
Posts: n/a
 
      04-03-2005
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



 
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
convert XML to XSD? or DTD to XSD? Matt XML 3 09-11-2008 12:40 PM
Overriding XSD locations when validating an xml document with multiple xsd references anthony@jayasekera.net Java 0 08-25-2006 11:22 AM
Validation of XSD (XML Schema) against XSD Rushi XML 1 12-09-2005 08:12 AM
XML + XSD: Is it possible to get all errors against the XSD? Markus Java 1 11-22-2005 02:53 PM
XML schema - Make xsd include another xsd stiank81 XML 4 06-26-2005 05:11 PM



Advertisments