|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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:
<xs:choice>
...
</xs:choice>
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">
...
</xs:choice>
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" />
</xs:choice>
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
---
Jeni Tennison
http://www.jenitennison.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








