xsd:all too restrictive, what do I use?
Posted: Thu Aug 26, 2010 1:21 am
Hi all, and thanks in advance for any advice;
I am trying to represent some XML in an XSD schema, but having troubles.
I need to make a schema that allows for, something which was inspired from ANT, and looks like this;
where the 'and', 'or', and 'not' elements must be able to accept any number of child 'and', 'or', 'not', and 'equals' elements.
There must not be any order restrictions.
That is, I think the xsd:all element almost suits the occasion, but not the cardinality requirements.
The 'when' tag is easier. It can take either 'and, equals, or, not' elements (that is the easy part, simply use an xsd:choice element.
Can anyone show me how I would define a schema which allows for the above XML?
I am trying to represent some XML in an XSD schema, but having troubles.
I need to make a schema that allows for, something which was inspired from ANT, and looks like this;
Code: Select all
<when result="template.txt">
<and>
<equals property="Department" value="Finance"/>
<equals property="Size" value="1"/>
<or>
<equals property="User" value="John"/>
<equals property="User" value="Admin"/>
</or>
</and>
</when>
There must not be any order restrictions.
That is, I think the xsd:all element almost suits the occasion, but not the cardinality requirements.
The 'when' tag is easier. It can take either 'and, equals, or, not' elements (that is the easy part, simply use an xsd:choice element.
Can anyone show me how I would define a schema which allows for the above XML?