Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Combining maxOccurs="unbounded" with all indicator

From: Frans Englich <frans.englich@-----.--->
To: "Xmlschema-dev" <xmlschema-dev@--.--->
Date: 11/10/2004 11:13:00 AM
On Monday 01 November 2004 13:26, Jeni Tennison wrote:
> Hi Frans,
>
> > How do I achieve this -- allow multiple unbounded elements to be
> > freely mixed with each others and simple elements?
>
> This is probably the most frequent of FAQs.
>
> DTDs have a similar restriction, and the traditional approach is to
> define the model using something like:
>
>   ((include | group)*, kcfgfile, (include | group)*)

I have a similar problem again, but this time a DTD expression validates for 
it. It looks like this:

<!ELEMENT Menu (title | Action | ActionList | Separator | WeakSeparator | 
TearOffHandle | Merge | MergeLocal | DefineGroup | Menu )*>


My DTD knowledge is smaller than what I know about XML Schema, but to me that 
reads like Menu may contain zero or more of those listed items, in any order.

I tried to replicate it in XML Schema(snipped and compacted):

<xsd:element name="Menu">
<xsd:complexType>
    <xsd:all>
        <xsd:element minOccurs="0" name="title" type="caption" />

        <xsd:element ref="Action" maxOccurs="unbounded" />
        <xsd:element ref="ActionList" maxOccurs="unbounded" />

        <xsd:element minOccurs="0" maxOccurs="unbounded" name="TearOffHandle">
        </xsd:element>

        <xsd:element minOccurs="0" maxOccurs="unbounded" name="DefineGroup">
        </xsd:element>

        <xsd:element minOccurs="0" maxOccurs="unbounded" name="MergeLocal">
        </xsd:element>

        <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Separator" />
        <xsd:element minOccurs="0" maxOccurs="unbounded" 				 
ref="WeakSeparator" />
        <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Menu" />
        <xsd:element minOccurs="0" maxOccurs="unbounded" name="Merge" />
    </xsd:all>


This obviously doesn't work since 'all' indicator and maxOccurs="unbounded" is 
combined, but it illustrates what I want. Is it impossible to express such 
constructs, which works in DTD, in XML Schema, or have I missed something?


Cheers,

		Frans


From george@o... Wed Nov 10 11:53:07 2004
Received: from bart.w3.org ([128.30.52


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