One element -> multiple types ? [message #598089] |
Mon, 15 May 2006 12:55 |
Guillaume Windels Messages: 29 Registered: July 2009 |
Junior Member |
|
|
Hiya,
I'm tackling a design issue here. The following bit of XML Schema should
help. Is there any way I can tell this schema that one element can be of
different types?
These types actually quite look like the same (i.e.: have the same child
type in common [ZZZ]) except for the set of attributes they are tied to.
Namely, AAA, BBB or CCC may have attributes in common.
<xsd:complexType name="myComplexType">
<xsd:sequence>
<xsd:element name="myElement" minOccurs="0" maxOccurs="unbounded"
type="AAA"/>
-- ideally type="AAA|BBB|CCC"
<!-- some elements -->
</xsd:sequence>
<!-- some attributes -->
</xsd:complexType>
<xsd:complexType name="AAA">
<xsd:sequence>
<xsd:element name="ZZZ" type="xsd:string"/>
</xsd:sequence>
<!-- some attributes -->
</xsd:complexType>
<xsd:complexType name="BBB">
<xsd:sequence>
<xsd:element name="ZZZ" type="xsd:string"/>
</xsd:sequence>
<!-- some attributes -->
</xsd:complexType>
<xsd:complexType name="CCC">
<xsd:sequence>
<xsd:element name="ZZZ" type="xsd:string"/>
</xsd:sequence>
<!-- some attributes -->
</xsd:complexType>
|
|
|
Powered by
FUDForum. Page generated in 0.02951 seconds