I'm trying to declare an element which is one of 2 complex types.
I have 2 complex types, say
Code:
<xs:complexType name="ElemType1">
<xs:sequence>
<xs:element name="child1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ElemType2">
<xs:sequence>
<xs:element name="child2"/>
</xs:sequence>
</xs:complexType>
However, I can't quite get the syntax down for the element declaration.
Code:
<xs:element name="root">
<xs:complexType>
<xs:choice>
<xs:complexType name="ElemType1"/>
<xs:complexType name="ElemType2"/>
</xs:choice>
</xs:complexType>
</xs:element>
This will not validate obviously. How is it possible to achieve this?
Note: the actual types are imported from other files, I don't have control over them; otherwise I would simply rewrite the type.
Thanks.