Is it possible to alternate between two types in an XML Schema
- by lief79
I'm wondering if I am missing something obvious.
I have a list of numbers, possibly including ranges (think of the print page option of a print dialog).
Ideally I'd like to have the final XML output look like this, with page and pageRange in an order.
<pages>
<page> 1</page>
<pageRange><start>3</start><end>6</end></pageRange>
<page> 34</page>
</pages>
What would I have to put into a schema to allow this?
From what I saw:
Sequence with multiple page and page Range allowed doesn't permit alternation.
Choice only allows one or the other.
I tried messing with all, but I wasn't getting it to validate properly.
My short term solution is to have a sequence of ranges, and to force single numbers into the range, but it seems potentially cumbersome. So am I missing something?