P
Piper707
Hi,
I need to know if there is any way of achieving conditional processing
for XSD elements.
---------------------------------------------------------------
<criteria></criteria> = a complex element
<join_condition></join_condition> = a simple element
---------------------------------------------------------------
EX:
<criteria>....</criteria>
<join_condition>.....</join_condition>
<criteria> .....</criteria>
---------------------------------------------------------------
I need the 1st criteria block to be mandatory. But it makes sense to
have a second criteria block, only if a join condition block has been
provided.
so it would be illegal to have only:
---------------------------------------------------------------
<criteria>....</criteria>
<join_condition>.....</join_condition>
---------------------------------------------------------------
I'm trying to impose the restriction: "if join_condition occurs once, a
criteria block must occur once under it."
I was trying to use the "group" conditional, but it points out
xs:sequence to be illegal, i'm not sure why? -
<xs:group name="criteria_and_join" minOccurs="0">
<xs:sequence>
<xs:element name="join_condition">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="AND"/>
<xs:enumeration value="OR"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element ref="criteria"/> //defined elewhere as a
complex type
</xs:sequence>
</xs:group>
How can achieve the conditional restriction that a criteria block can
only appear provided a join_condition block precedes it (except for the
very first criteria block)?
Thanks
Rohit.
I need to know if there is any way of achieving conditional processing
for XSD elements.
---------------------------------------------------------------
<criteria></criteria> = a complex element
<join_condition></join_condition> = a simple element
---------------------------------------------------------------
EX:
<criteria>....</criteria>
<join_condition>.....</join_condition>
<criteria> .....</criteria>
---------------------------------------------------------------
I need the 1st criteria block to be mandatory. But it makes sense to
have a second criteria block, only if a join condition block has been
provided.
so it would be illegal to have only:
---------------------------------------------------------------
<criteria>....</criteria>
<join_condition>.....</join_condition>
---------------------------------------------------------------
I'm trying to impose the restriction: "if join_condition occurs once, a
criteria block must occur once under it."
I was trying to use the "group" conditional, but it points out
xs:sequence to be illegal, i'm not sure why? -
<xs:group name="criteria_and_join" minOccurs="0">
<xs:sequence>
<xs:element name="join_condition">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="AND"/>
<xs:enumeration value="OR"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element ref="criteria"/> //defined elewhere as a
complex type
</xs:sequence>
</xs:group>
How can achieve the conditional restriction that a criteria block can
only appear provided a join_condition block precedes it (except for the
very first criteria block)?
Thanks
Rohit.