defining specific Number of elements in Relax NG Schema

256 views Asked by At

I want to ask you how to define a specific number of elements in Relax NG Schema.For example, I have an XML file about a contest. In this contest, there should be only two teams. no more than two teams what I have done so far is

element teams{ element team {xsd:string}+ }

but + always means one or more Could you please help me

1

There are 1 answers

0
Aleksi Yrttiaho On BEST ANSWER

RelaxNG only supports define, oneOrMore, zeroOrMore, optional, list or mixed. You cannot define an arbitary amount of elements. You can however list each element that may be included. To make the listing easier you may create the list from elements that contains lists, though that isn't any better. Here's an example with groupings of five.

For the case of two, it is easiest to write

element teams { element team{xsd:string}, element team{xsd:string} }