OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: representing content model in XML Schema

Hi James,

> Can anybody tell me how to represent the following content group in
> XML Schema?
> (a|b|c)*

The | separators mean its a choice, so you use an xs:choice element:


The * means that it can occur between 0 and any number of times - that
gets translated into minOccurs="0" maxOccurs="unbounded".

  <xs:choice minOccurs="0" maxOccurs="unbounded">

The a, b and c are references to elements that you've declared
globally, so you use xs:element elements with ref attributes giving
the names of the elements:

  <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element ref="a" />
    <xs:element ref="b" />
    <xs:element ref="c" />

Depending on the pattern you're using in your schema, you might
declare the elements locally within the group rather than referring to
globally declared elements.
I hope that helps,


Jeni Tennison