XML Schema --- <xs:choice maxOccurs=5>

H

hooomee

Given:

<xs:choice maxOccurs=5>
<xs:element name="Foo" type="bar" />
<xs:element name="Foo1" type="bar" />
<xs:element name="Foo2" type="bar" />
</xs:choice>

Is the choice made once and then the choosen element can occur 5 times,
or is the choice made once for each occurance?

I'm looking for the first behavior, choose once, then allow the choosen
element 5 times. I'm not sure how to get that..
 
S

Stan Kitsis [MSFT]

What you have will make five choices. What you want is (replace
min/maxOccurs with whatever boundaries you need):

<xs:choice>
<xs:element name="Foo" type="bar" minOccurs="5" maxOccurs="5"/>
<xs:element name="Foo1" type="bar" minOccurs="5" maxOccurs="5"/>
<xs:element name="Foo2" type="bar" minOccurs="5" maxOccurs="5"/>
</xs:choice>

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
J

Joe Kesselman

Is the choice made once and then the choosen element can occur 5 times,
or is the choice made once for each occurance?

Simplest way to answer this sort of question is often to try it and see
what it does. (I think the answer is "choose five times", as you want it
to be, but I don't do enough with schemas to be certain and I'd try it
myself.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,002
Messages
2,570,260
Members
46,858
Latest member
FlorrieTuf

Latest Threads

Top