W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2003

Re: XML Schema: Alternating "unbounded" elements

From: <noah_mendelsohn@us.ibm.com>
Date: Fri, 18 Apr 2003 15:07:49 -0400
To: "Mohan Raj" <mohanrajd@hotmail.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OF92D420D5.59A406E9-ON85256D0C.00481A1A@lotus.com>

This is a very frequently asked question, and the answer is similar for 
Schema and for the older DTDs:

        <choice minOccurs="0" maxOccurs="unbounded">
                <element ref="field1"/>
                <element ref="field2"/>
                <element ref="field3"/>
                <element ref="field4"/>

The choice lets you pick any one of the fields.  The repetition allows the 
whole choice to be made repeatedly.  In DTD terms this is:

        (field1, field2, field3, field4)*

Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142

"Mohan Raj" <mohanrajd@hotmail.com>
Sent by: xmlschema-dev-request@w3.org
04/17/2003 07:37 PM

        To:     xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        XML Schema: Alternating "unbounded" elements

I am fairly new to XML and i searched through the archives but did not 
any solution for this issue.

I am trying to define a schema that can validate the following XML 








i have a bunch of fields field1 through field10 and i can have multiple 
occurences of every field (maxOccurs = "unbounded") and they need not be 
a sequence (i.e.
field1 occuring thrice followed by field2 occuring twice etc). these 
elements can alternate as shown above (in any order).

please provide a sample schema that can do something like this. i 
your help.


Help STOP SPAM with the new MSN 8 and get 2 months FREE* 
Received on Friday, 18 April 2003 15:15:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:01 UTC