W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

Substitution group with members having simpleContent or complexCo ntent

From: Mark Feblowitz <mfeblowitz@frictionless.com>
Date: Thu, 24 Jan 2002 17:56:16 -0500
Message-ID: <4DBDB4044ABED31183C000508BA0E97F024D5786@fcpostal.frictionless.com>
To: "Xmlschema-Dev (E-mail)" <xmlschema-dev@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:26 GMT