Require non-empty sequence
Posted: Thu Jul 29, 2010 12:48 pm
I'm using Schema to define the structure of my XML. At this stage it's not going to be easy to switch to a different metalanguage.
Can I define an element <parent> that has a sequence of child elements which are individually optional (i.e. no specific one is required) but where at least one has to be present?
So the following are OK:
<parent><a/></parent>
<parent><b/></parent>
<parent><c/></parent>
<parent><d/></parent>
<parent><a/><b/></parent>
<parent><b/><d/></parent>
<parent><a/><b/><c/><d/></parent>
but the following are invalid:
<parent><c/><a/></parent>
<parent/>
I think this is impossible using just Schema, but perhaps I'm missing some easy way of doing it.
Can I define an element <parent> that has a sequence of child elements which are individually optional (i.e. no specific one is required) but where at least one has to be present?
So the following are OK:
<parent><a/></parent>
<parent><b/></parent>
<parent><c/></parent>
<parent><d/></parent>
<parent><a/><b/></parent>
<parent><b/><d/></parent>
<parent><a/><b/><c/><d/></parent>
but the following are invalid:
<parent><c/><a/></parent>
<parent/>
I think this is impossible using just Schema, but perhaps I'm missing some easy way of doing it.