XSD sequence

  • Thread starter =?ISO-8859-1?Q?L=FCpher_Cypher?=
  • Start date
?

=?ISO-8859-1?Q?L=FCpher_Cypher?=

Hi,
I'm trying to have a sequence which will validate both of the following
XMLs:

<root>
<a>text</a>
<b>text</b>

<c>text</c>
<c>text</c>
...
<c>text</c>

<d>text</d>
<d>text</d>
...
<d>text</d>

<e>...</e>
</root>

and

<root>
<a>text</a>
<b>text</b>

<d>text</d>
<d>text</d>
...
<d>text</d>

<c>text</c>
<c>text</c>
...
<c>text</c>

<e>...</e>
</root>

So, I have

<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="a" type="xs:string" />
<xs:element name="b" type="xs:string" />
???
<xs:element name="e" type="sometype" />
</xs:sequence>
</xs:complexType>
</xs:element>

Is there a way to say that each of <c> and <d> can appear a number of
times (like in <xs:sequence><xs:elem name="c" minOccurs="0"
maxOccurs="unbounded" /></xs:sequence>) but the order in which they
appear does not matter? In other words, there may be zero or more <c>
tags followed by zero or more <d> tags, or zero or more <d> tags
followed by zero or more <c> tags.

Thanks,
luph
 
H

Henry S. Thompson

Your question boils down to converting a content model which one might
start by writing as

(a*,b*,((c*,d*)|(d*,c*)),e*)

into a form which is legal.

This is an FAQ, to which the answer is

(a*,b*,((c+,d*)|(d+,c*))?,e*)

ht
--
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]
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top