[
Lists Home |
Date Index |
Thread Index
]
- To: xml-dev@lists.xml.org
- Subject: minOccurs maxOccurs doesnt seem to be working correctly in my schema
- From: Marielou <marielou_h@yahoo.co.uk>
- Date: Tue, 13 Jun 2006 17:13:38 +0100 (BST)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=VRxTqMhWujFLKl3ztLEv8iDqE107a1R6oCQlfZhiT9djwC/0DEUf0qHtygIjOEx/YC6SgLjVPjrRp3OmOB0tQbKUNd5CsScWdDRDlHo/NFGhK8x2ORWQ3SdOWDm1r6pnNEHfN4ba2h8MkZC3INTJIY+VYcYxah22ZKJzpzyWvus= ;
In my schema, elements should not have any
restrictions on their sequence however they have
restrictions on their occurence, some can occur more
than once, the number of occurences is specified in
the schema. I have tried to restrict occurences with
minOccurs maxOccurs in an <all> tag, with the actual
number of occurences specified in a separate element
with complexType referenced from the <all> with an
element ref to the elementnameChoice if it should be
able to occur more than once. Im a total newbie to
schemas and dont know if this should work, but Im
finding that my restrictions on occurences are not
seeming to work at all. e.g. in an XML file validated
against the schema, any element seems to be able to
occur or not regardless which occurence values I
encoded in the schema. Please help!
================================================
<?xml version="1.0" encoding="ISO-8859-9"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<xs:import
namespace="http://www.w3.org/XML/1998/namespace"/>
<!--xs:import namespace="iso_3166-1_list_en"/-->
<!-- definition of simple types -->
<xs:simpleType name="progidType">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="4294967295"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="linkType">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nameType">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="49"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nameRestriction">
<xs:restriction base="xs:token">
<xs:maxLength value="35"/>
</xs:restriction>
</xs:simpleType>
<!-- definition of elements -->
<xs:element name="progid" type="progidType"/>
<xs:element name="sid" type="progidType"/>
<!-- definition of attributes -->
<xs:attribute name="copyright">
<xs:simpleType>
<xs:restriction base="xs:token">
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:element name="audioChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="audio" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="audio">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="epg">
<xs:complexType>
<xs:sequence>
<xs:element name="prog" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute ref="xml:lang"/>
<xs:anyAttribute/>
</xs:complexType>
</xs:element>
<xs:element name="image">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute ref="copyright" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="linkChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="link" minOccurs="0"
maxOccurs="7"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="link">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="progidType">
<xs:attribute name="type" type="linkType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="nameChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="name" minOccurs="0"
maxOccurs="4"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="nameRestriction">
<xs:attribute name="type" type="nameType"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:unique name="uniqueName">
<xs:selector xpath="name"/>
<xs:field xpath="name"/>
<xs:field xpath="name_ext"/>
</xs:unique>
</xs:element>
<xs:element name="name_ext">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:normalizedString">
<xs:attribute name="type" type="nameType"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="name_extChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="name_ext" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="tvtvid">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="32767"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="start" type="epgDateTime"/>
<xs:simpleType name="epgDateTime">
<xs:restriction base="xs:string">
<xs:pattern
value="[1-2][0-9][0-9][0-9]-(01|02|03|04|05|06|07|08|09|10|11|12)-[0-9]{2}T(01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|00):(00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59)"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="end" type="epgDateTime"/>
<xs:element name="pil">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="1048575"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="title">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Title">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="titleChoice">
<xs:complexType>
<xs:choice>
<xs:element ref="title" minOccurs="1"
maxOccurs="1"/>
<xs:element ref="Title" minOccurs="1"
maxOccurs="1"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="otitle">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ltext">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="dtext">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="400"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="snr">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern
value="[0-9]*|[0-9]*-[0-9]*|[0-9]*,[0-9]*"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="sct">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="65535"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="country">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:maxLength value="15"/>
<!--xs:ISO_3166-1_Alpha-2_Code_element></xs:ISO_3166-1_Alpha-2_Code_element-->
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="year">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="9"/>
<xs:pattern value="([0-9,\-,\,,]*)"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="fsk">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="2"/>
<xs:maxInclusive value="18"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="format">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="11"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="subtitleChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="subtitle" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="subtitle">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ver">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="65535"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="videoChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="video" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="video">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="7"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="tip">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="contentChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="content" minOccurs="0"
maxOccurs="7"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="content">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
<xs:enumeration value="3"/>
<xs:enumeration value="4"/>
<xs:enumeration value="5"/>
<xs:enumeration value="6"/>
<xs:enumeration value="7"/>
<xs:enumeration value="8"/>
<xs:enumeration value="9"/>
<xs:enumeration value="10"/>
<xs:enumeration value="11"/>
<xs:enumeration value="12"/>
<xs:enumeration value="13"/>
<xs:enumeration value="14"/>
<xs:enumeration value="15"/>
<xs:enumeration value="16"/>
<xs:enumeration value="17"/>
<xs:enumeration value="18"/>
<xs:enumeration value="19"/>
<xs:enumeration value="20"/>
<xs:enumeration value="21"/>
<xs:enumeration value="22"/>
<xs:enumeration value="23"/>
<xs:enumeration value="24"/>
<xs:enumeration value="32"/>
<xs:enumeration value="33"/>
<xs:enumeration value="34"/>
<xs:enumeration value="35"/>
<xs:enumeration value="36"/>
<xs:enumeration value="48"/>
<xs:enumeration value="49"/>
<xs:enumeration value="50"/>
<xs:enumeration value="51"/>
<xs:enumeration value="64"/>
<xs:enumeration value="65"/>
<xs:enumeration value="66"/>
<xs:enumeration value="67"/>
<xs:enumeration value="68"/>
<xs:enumeration value="69"/>
<xs:enumeration value="70"/>
<xs:enumeration value="71"/>
<xs:enumeration value="72"/>
<xs:enumeration value="73"/>
<xs:enumeration value="74"/>
<xs:enumeration value="75"/>
<xs:enumeration value="80"/>
<xs:enumeration value="81"/>
<xs:enumeration value="82"/>
<xs:enumeration value="83"/>
<xs:enumeration value="84"/>
<xs:enumeration value="85"/>
<xs:enumeration value="96"/>
<xs:enumeration value="97"/>
<xs:enumeration value="98"/>
<xs:enumeration value="99"/>
<xs:enumeration value="100"/>
<xs:enumeration value="101"/>
<xs:enumeration value="102"/>
<xs:enumeration value="112"/>
<xs:enumeration value="113"/>
<xs:enumeration value="114"/>
<xs:enumeration value="115"/>
<xs:enumeration value="116"/>
<xs:enumeration value="117"/>
<xs:enumeration value="118"/>
<xs:enumeration value="119"/>
<xs:enumeration value="120"/>
<xs:enumeration value="121"/>
<xs:enumeration value="122"/>
<xs:enumeration value="123"/>
<xs:enumeration value="128"/>
<xs:enumeration value="129"/>
<xs:enumeration value="130"/>
<xs:enumeration value="131"/>
<xs:enumeration value="144"/>
<xs:enumeration value="145"/>
<xs:enumeration value="146"/>
<xs:enumeration value="147"/>
<xs:enumeration value="148"/>
<xs:enumeration value="149"/>
<xs:enumeration value="150"/>
<xs:enumeration value="151"/>
<xs:enumeration value="160"/>
<xs:enumeration value="161"/>
<xs:enumeration value="162"/>
<xs:enumeration value="163"/>
<xs:enumeration value="164"/>
<xs:enumeration value="165"/>
<xs:enumeration value="166"/>
<xs:enumeration value="167"/>
<xs:enumeration value="176"/>
<xs:enumeration value="177"/>
<xs:enumeration value="178"/>
<xs:enumeration value="179"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="catChoice">
<xs:complexType>
<xs:sequence>
<xs:element ref="cat" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="cat">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:enumeration value="256"/>
<xs:enumeration value="257"/>
<xs:enumeration value="258"/>
<xs:enumeration value="259"/>
<xs:enumeration value="260"/>
<xs:enumeration value="261"/>
<xs:enumeration value="262"/>
<xs:enumeration value="263"/>
<xs:enumeration value="264"/>
<xs:enumeration value="265"/>
<xs:enumeration value="266"/>
<xs:enumeration value="267"/>
<xs:enumeration value="268"/>
<xs:enumeration value="269"/>
<xs:enumeration value="270"/>
<xs:enumeration value="271"/>
<xs:enumeration value="272"/>
<xs:enumeration value="512"/>
<xs:enumeration value="513"/>
<xs:enumeration value="514"/>
<xs:enumeration value="515"/>
<xs:enumeration value="516"/>
<xs:enumeration value="517"/>
<xs:enumeration value="518"/>
<xs:enumeration value="519"/>
<xs:enumeration value="520"/>
<xs:enumeration value="768"/>
<xs:enumeration value="769"/>
<xs:enumeration value="770"/>
<xs:enumeration value="771"/>
<xs:enumeration value="772"/>
<xs:enumeration value="773"/>
<xs:enumeration value="774"/>
<xs:enumeration value="1024"/>
<xs:enumeration value="1025"/>
<xs:enumeration value="1026"/>
<xs:enumeration value="1027"/>
<xs:enumeration value="1028"/>
<xs:enumeration value="1029"/>
<xs:enumeration value="1030"/>
<xs:enumeration value="1031"/>
<xs:enumeration value="1032"/>
<xs:enumeration value="1033"/>
<xs:enumeration value="1034"/>
<xs:enumeration value="1035"/>
<xs:enumeration value="1036"/>
<xs:enumeration value="1037"/>
<xs:enumeration value="1280"/>
<xs:enumeration value="1281"/>
<xs:enumeration value="1282"/>
<xs:enumeration value="1283"/>
<xs:enumeration value="1284"/>
<xs:enumeration value="1285"/>
<xs:enumeration value="1286"/>
<xs:enumeration value="1287"/>
<xs:enumeration value="1536"/>
<xs:enumeration value="1537"/>
<xs:enumeration value="1538"/>
<xs:enumeration value="1539"/>
<xs:enumeration value="1540"/>
<xs:enumeration value="1541"/>
<xs:enumeration value="1542"/>
<xs:enumeration value="1543"/>
<xs:enumeration value="1544"/>
<xs:enumeration value="1792"/>
<xs:enumeration value="1793"/>
<xs:enumeration value="1794"/>
<xs:enumeration value="1795"/>
<xs:enumeration value="1796"/>
<xs:enumeration value="1797"/>
<xs:enumeration value="1798"/>
<xs:enumeration value="1799"/>
<xs:enumeration value="1800"/>
<xs:enumeration value="1801"/>
<xs:enumeration value="2048"/>
<xs:enumeration value="2049"/>
<xs:enumeration value="2050"/>
<xs:enumeration value="2051"/>
<xs:enumeration value="2052"/>
<xs:enumeration value="2053"/>
<xs:enumeration value="2054"/>
<xs:enumeration value="2055"/>
<xs:enumeration value="2056"/>
<xs:enumeration value="2057"/>
<xs:enumeration value="2058"/>
<xs:enumeration value="2059"/>
<xs:enumeration value="2060"/>
<xs:enumeration value="2061"/>
<xs:enumeration value="2062"/>
<xs:enumeration value="2063"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="prog">
<xs:complexType>
<xs:all>
<xs:element ref="progid" minOccurs="1"
maxOccurs="1"/>
<xs:element ref="tvtvid" minOccurs="1"
maxOccurs="1"/>
<xs:element ref="start" minOccurs="1"
maxOccurs="1"/>
<xs:element ref="end" minOccurs="1"
maxOccurs="1"/>
<xs:element ref="pil" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="titleChoice" minOccurs="1"
maxOccurs="1"/>
<xs:element ref="otitle" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="ltext" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="dtext" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="sid" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="snr" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="sct" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="country" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="year" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="fsk" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="format" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="nameChoice" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="name_extChoice" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="contentChoice" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="image" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="ver" minOccurs="1"
maxOccurs="1"/>
<xs:element ref="linkChoice" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="subtitleChoice" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="audioChoice" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="videoChoice" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="tip" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="catChoice" minOccurs="0"
maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Send instant messages to your online friends http://uk.messenger.yahoo.com
|