Reputation: 285
This seems to be a limitation of XML Schema 1.0 but I'm giving it one last try.
Say I have
<?xml version="1.0" encoding="UTF-8"?>
<Box>
<RedToy/>
<BlueToy/>
</Box>
The box can have {1,unbounded}
toys.
There's always at least one of either <RedToy/>
or <BlueToy/>
.
There can be any combination of red and blue.
Order is arbitrary, and there's therefore arbitrary numbers of boundaries between series of red and series of blue, so for example, this answer does not work:
XSD schema for multiple XML elements with at least one present, in any order
This is impossible to define with XSD 1.0, right?
XML schema construct for "any one or more of these elements but must be at least one"
Upvotes: 0
Views: 113
Reputation: 163458
I'm not sure I've understood what you mean by "at least one of either". Do you mean (a) at least one Red and at least one Blue, or (b) at least one Toy, which may be either Red or Blue)?
(a) would, I think, be
( R+ B (R|B)* ) | ( B+ R (R|B)* )
(b) would be simply
(R|B)+
Upvotes: 1