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

Reusing the XMLSchema simpleType element in an own schema

From: <gino.marckx@belgacom.be>
Date: Wed, 28 Aug 2002 12:22:36 +0200
Message-ID: <06187E0800A0D21192DD0008C75DE4DC0861CCEE@acar41.bc>
To: xmlschema-dev@w3c.org

Hi,

I want to reuse the simpleType element definition we all use for defining our own schema's, in a schema.  In other words, I want to be able in the XML document, using my schema, to define simpleType elements as data.

Example:
<types xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
	<type name="myStringType" type="xsd:string"/>
	<type name="myEnumerationBasedOnStringType">
		<xsd:simpleType>
			<!-- If the following is impossible, it could restrict xsd:string too -->
			<xsd:restriction base="myStringType">
				<xsd:enumeration>Possible value</xsd:enumeration>
			</xsd:restriction>
		</xsd:simpleType>
	</type>
</types>

I tried to specify the type element like the following, but on validation I always get the same error stating that the type cannot be found, even when I import the schema:
<xsd:element name="type">
	<xsd:complexType>
		<xsd:sequence>
			<xsd:element name="simpleType" type="xsd:anySimpleType" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="name" value="xsd:string"/>
		<xsd:attribute name="type" value="xsd:QName" use="optional"/>
	</xsd:complexType>
</xsd:element>

Can anybody help me with this problem, after looking for documentation for a long while, I am stuck, and I just cannot believe it is not possible.

Thanks in advance,
Gino Marckx.

**** DISCLAIMER **** 
"This e-mail and any attachments thereto may contain information 
which is confidential and/or protected by intellectual property 
rights and are intended for the sole use of the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, 
total or partial reproduction, communication or distribution in any form) 
by persons other than the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either 
by telephone or by e-mail and delete the material from any computer. 
Thank you for your cooperation."
Received on Wednesday, 28 August 2002 06:22:49 GMT

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