Is it possible to alternate between two types in an XML Schema
Posted
by lief79
on Stack Overflow
See other posts from Stack Overflow
or by lief79
Published on 2010-04-21T15:14:53Z
Indexed on
2010/04/21
18:53 UTC
Read the original article
Hit count: 373
xml-schema
|Xml
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?
© Stack Overflow or respective owner