Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - problem with occurence of elements [Thread Next] Re: problem with occurence of elementsTo: XML Schema List <xmlschema-dev@--.---> Date: 3/9/2008 2:52:00 PM
At 2008-03-09 23:35 +0100, Andreas Peter wrote:
>This is my complexType:
>
> <xs:complexType name="chapterType">
> <xs:sequence>
> <xs:element name="title"/>
> <xs:choice>
> <xs:element name="subtitle"/>
> <xs:element name="author"/>
> <xs:element name="para"/>
> <xs:element name="sect1"/>
> </xs:choice>
> </xs:sequence>
> </xs:complexType>
>
>I try to realise, that after the required title-element the author-,
>para- and sect1-element can occure unboundedly and the
>subtitle-element can occure only once. There should also be the
>restriction that if an sect1-element occures the para-, author- or
>subtitle-element should not occure.
You have a contradiction there: you are requiring two different
behaviours in the presence of sect1 ... the first case it allows the
others, and the second case it does not.
To proceed, I'll assume that you did not mean for sect1 to be allowed
in the first case:
<xs:complexType name="chapterType">
<xs:sequence>
<xs:element name="title"/>
<xs:choice>
<!--the author- and para-element can occur unboundedly
and the subtitle-element can occur only once-->
<xs:sequence>
<xs:element name="subtitle"/>
<xs:choice maxOccurs="unbounded">
<xs:element name="author"/>
<xs:element name="para"/>
</xs:choice>
</xs:sequence>
<!--if an sect1-element occurs the para-, author- or
subtitle-element should not occur-->
<xs:element name="sect1"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
I hope this helps.
. . . . . . . . . . Ken
--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:gkholman@C...
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
From jesdisciple@g... Mon Mar 10 03:08:56 2008
Received: from wiggum.w3.org ([128.30.52.23] | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
