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

Substitution group and abstract element

From: Piccand Régis <regis.piccand@imtf.ch>
Date: Tue, 12 Feb 2002 09:50:42 +0100
Message-ID: <DF7EC83D7AFBD411965B0008C7596EC53ED57F@imtfexchange.imtf.ch>
To: " 'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Hi all,

I am using a substitution group where the "head" element is abstract.

In the instance document, I use the xsi:type to specify the type to use.
However, it looks like the validator doesn't accept the types in the
substitution group.

the schema :

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="rootElt">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="contentType"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="textContent" type="xs:string"
substitutionGroup="contentType"/>
	<xs:element name="base64Content" type="xs:base64Binary"
substitutionGroup="contentType"/>
	<xs:element name="contentType" abstract="true"/>
</xs:schema>


The instance document : 

<rootElt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\Temp\Untitled10.xsd">
	<contentType xsi:type="textContent"></contentType>
</rootElt>

Error (XML Spy 4.3) : This file is not valid : Schema error - element or
complexType 'contentType' is declared as abstract='true' ; please use
xsi:type to specify a derived type that is not abstract, or use a member of
a substitutionGroup instead.

Am I doing something wrong here ?

Thanks in advance for your help.

Régis
Received on Tuesday, 12 February 2002 03:57:48 GMT

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