Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » One element -> multiple types ?
One element -> multiple types ? [message #598089] Mon, 15 May 2006 12:55
Guillaume Windels is currently offline Guillaume WindelsFriend
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>
Previous Topic:getFacets() Vs getFacetContents()
Next Topic:One element -> multiple types ?
Goto Forum:
  


Current Time: Thu Dec 18 09:46:26 GMT 2014

Powered by FUDForum. Page generated in 0.02007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software