RE: Substitution group with members having simpleContent or compl exCo ntent

I think the only way to have a single hierarchy with both 
simpleContent and complexContent descendents is to have 
an "anyType" /element/ at the head of a /substitutionGroup/.  
anyType is special in this way [1].   

You can declare the head element typed either implicitly

<element name="head" abstract="true"/>

or explicitly

<element name="head" type="anyType" abstract="true"/>

OTOH, as soon as you make a <complexType> definition, it 
either has <simpleContent> derived by restriction or extension from one of
the primitives, 
or it implicitly has complexContent - which may be empty, and thus cannot be
restricted further.  

The only possible opening to derive simpleContent from 
complexContent is if the complexContent is "mixed" and emptiable 
- see sub-clause 5.1.2 in "Schema Component Constraint: Derivation 
Valid (Restriction, Complex) " at [2].  

But there is a known contradiction in trying to actually build this [3].  


[1] http://www.w3.org/TR/xmlschema-1/#Type_Definition_Summary
[2] http://www.w3.org/TR/xmlschema-1/#coss-ct
[3] http://www.w3.org/TR/xmlschema-2/#defn-rep-constr
_____
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (8) 6436 8639  F: +61 (8) 6436 8555  C: +61 (4) 0330 2672
http://www.csiro.au/page.asp?type=resume&id=CoxSimon

> -----Original Message-----
> From: Mark Feblowitz [mailto:mfeblowitz@frictionless.com]
> Sent: Friday, 25 January 2002 6:56 AM
> To: Xmlschema-Dev (E-mail)
> Subject: 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 23:05:11 UTC