Occurrence problem

M

Martin Perreault

Hello,

I cannot find a schema structure that would accommodate the following
occurence and ordering restrictions. Please note that this is only an
example and that a typical RootElement has around 20 children element.


<xs:element name="RootElement">
<xs:complexType mixed="true">
<xs:???>
<xs:element ref="A" minOccurs="0" />
<xs:element ref="B" minOccurs="0"/>
<xs:element ref="C" minOccurs="1"/>
<xs:element ref="D" minOccurs="1"
maxOccurs="unbounded"/>
<xs:element ref="E" minOccurs="1"/>
<xs:element ref="F" minOccurs="0"/>
</xs:???>
</xs:complexType>
</xs:element>

In the xml document being validated, elements appear in no particular
order.

would anyone have a schema patern that would meet these criteria?

Thanks

Martin
 
H

Henry S. Thompson

<xs:element name="RootElement">
<xs:complexType mixed="true">
<xs:???>
<xs:element ref="A" minOccurs="0" />
<xs:element ref="B" minOccurs="0"/>
<xs:element ref="C" minOccurs="1"/>
<xs:element ref="D" minOccurs="1"
maxOccurs="unbounded"/>
<xs:element ref="E" minOccurs="1"/>
<xs:element ref="F" minOccurs="0"/>
</xs:???>
</xs:complexType>
</xs:element>

?? -> all


--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 
P

Priscilla Walmsley

Hi Martin,

You're right - you can't use maxOccurs="unbounded" with xs:all.

Your choices would be to
1. specify that they must appear in order
2. use a repeating choice group, which can't enforce that any of the
elements are required
3. put in an extra level, e.g. a <DList> element that contains all the
<D> elements as children.

Hope that helps,
Priscilla
 

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
473,998
Messages
2,570,242
Members
46,834
Latest member
vina0631

Latest Threads

Top