Defining multiple possibilities for the same element
- by moggi
Hello,
is it possible in XML Schema to define the same element with several different definitions depending on one attribute.
As Example:
<xsd:element name="Element">
<xsd:complexType>
<xsd:sequence>
<xsd:attribute name="type" fixed="type1"/>
<xsd:seqeuence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Element">
<xsd:complexType>
<xsd:sequence>
<xsd:attribute name="type" fixed="type2"/>
<xsd:attribute name="value" type="xsd:integer"/>
<xsd:seqeuence>
</xsd:complexType>
</xsd:element>
<xsd:element name="RootElement">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Element"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Or is there any other way to solve this problem.
It is important that both definitions are named "Element", because I have an application needing that both elements are named the same way. But there is a second application that needs the additional information for type2.