How define several elements with same name, but different type in xsd:choice element?
Posted
by Nikolay Ponomarenko
on Stack Overflow
See other posts from Stack Overflow
or by Nikolay Ponomarenko
Published on 2010-03-18T09:59:37Z
Indexed on
2010/03/18
10:01 UTC
Read the original article
Hit count: 454
Is it possible in some way, to define an xsd scheme which could validate such xml:
<item_list>
<item ItemType="SimpleMessage" Caption="Simplest message"/>
<item ItemType="ComplexMessage" SomeAttr="value">
<item_data>some text</item_data>
</item>
</item_list>
Problem is that i havn't find any possibility to define smth like:
<xsd:element name="Items">
<xsd:complexType>
<xsd:choice>
<xsd:element name="item" type="SimpleMessType"/>
<xsd:element name="item" type="ComplexMessType"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
But i need to check, that SimpleMessage has no child elements or additional attrs :(
© Stack Overflow or respective owner