Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: problem with occurence of elements

From: "G. Ken Holman" <gkholman@----------------.--->
To: 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]


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent