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

Discussion in 'XML' started by hooomee@gmail.com, Jun 5, 2006.

  1. Guest

    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..
    , Jun 5, 2006
    #1
    1. Advertising

  2. 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


    <> wrote in message
    news:...
    > 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..
    >
    Stan Kitsis [MSFT], Jun 5, 2006
    #2
    1. Advertising

  3. wrote:
    > 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.)
    Joe Kesselman, Jun 5, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,530
    Markus
    Nov 23, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,251
    Stanimir Stamenkov
    Apr 25, 2005
  3. Mavis
    Replies:
    0
    Views:
    432
    Mavis
    Jun 1, 2006
  4. mavis
    Replies:
    2
    Views:
    3,727
    mavis
    Jun 1, 2006
  5. Replies:
    3
    Views:
    2,836
Loading...

Share This Page