Substitution group with members having simpleContent or complexCo ntent

Is there any way that I could define a type, e.g., 

	<xs:complexType name="ItemId" abstract="true"/>

and then derive two extensions, one with simpleContent (specifically, of
type xs:string) and one of complexType?

It would be simple enough to define two separate types and be done with it.
What I'm really after is a substitution group with a head that is of the
above type, but which has derivations that are either contain simpleContent

	<MySimpleItemId>123</MySimpleItemId>

or complexContent 

	<MyComplexItemId><Name/><Address/></ MyComplexItemId>

The only way I can think to do it would be to declare the MySimpleItemId
type to have simpleContent and extend ItemId, and have a mixed="true" to
allow text:

	<xs:complexType name="MySimpleItemId" mixed="true">
		<xs:simpleContent>
			<xs:extension base="ItemId"/>
		</xs:simpleContent>
	</xs:complexType>

 The MyComplexItemId type could have complexContent and also extend ItemId,
building out the complexContent as  usual:

	<xs:complexType name="MyComplexItemId">
		<xs:complexContent>
			<xs:extension base="ItemId">
				<xs:sequence>
					<xs:element name="Revision"
type="Revision" minOccurs="0"/>
					<xs:element name="Code" type="Name"
minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

This seems like a hack, but appears to me to be the only way to have a
substitution group have members that are of different contentTypes.

A choice group could do the trick, but I'd like the group to have
substitution group extensibility. Is this possible?

Any better ideas?

Thanks,

Mark

----------------------------------------------------------------------------
----
 
Mark Feblowitz                                   [t] 617.715.7231
Frictionless Commerce Incorporated     [f] 617.495.0188 
XML Architect                                     [e]
mfeblowitz@frictionless.com
400 Technology Square, 9th Floor 
Cambridge, MA 02139 
www.frictionless.com  
 

Received on Thursday, 24 January 2002 17:56:48 UTC