A
Anon
Hi,
Having trouble creating a schema. I want the following chunks xml to be
acceptable
<a>
<b .... />
</a>
...or...
<a>
<c .... />
</a>
So element a can can have sub-elements b or c.
Constraints are: (1) a must have one of b or c, (2) a may only have one
of b or c.
The current schema I've got is as follows:
<xs:choice maxOccurs="1" minOccurs="1">
<xs:element name="b" type="typeB" minOccurs="0"/>
<xs:element name="c" type="typeC" minOccurs="0"/>
</xs:choice>
However, although this schema satisfies constraint (2), it allows me to
create element <a> without any sub-elements. In other words, the
minOccurs of the choice is being ignored.
Can anyone suggest an alternate approach?
If it makes any difference I'm using XML Spy to create all of this, and
will deploy to the MS Xml parser (whatever version is latest).
TIA,
Pete
Having trouble creating a schema. I want the following chunks xml to be
acceptable
<a>
<b .... />
</a>
...or...
<a>
<c .... />
</a>
So element a can can have sub-elements b or c.
Constraints are: (1) a must have one of b or c, (2) a may only have one
of b or c.
The current schema I've got is as follows:
<xs:choice maxOccurs="1" minOccurs="1">
<xs:element name="b" type="typeB" minOccurs="0"/>
<xs:element name="c" type="typeC" minOccurs="0"/>
</xs:choice>
However, although this schema satisfies constraint (2), it allows me to
create element <a> without any sub-elements. In other words, the
minOccurs of the choice is being ignored.
Can anyone suggest an alternate approach?
If it makes any difference I'm using XML Spy to create all of this, and
will deploy to the MS Xml parser (whatever version is latest).
TIA,
Pete