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

RE: enumerations

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Fri, 15 Feb 2002 10:49:12 -0800
Message-Id: <8904C60CACA7D51191BC00805FEAAF4358EAEB@crdc-exch-7.crdc.kp.org>
To: "'Eamon.Galavan@risk.sungard.com'" <Eamon.Galavan@risk.sungard.com>, xmlschema-dev@w3.org
> -----Original Message-----
> From:	Eamon.Galavan@risk.sungard.com [SMTP:Eamon.Galavan@risk.sungard.com]
> Sent:	Thursday, February 14, 2002 9:37 AM
> To:	xmlschema-dev@w3.org
> Subject:	enumerations
> 
> How do I implement enumerations in Schemas?
> 
without more detail, its hard to know exactly what your question means, but
I'll take a stab...if this isn't your question, please repost with more
specifics...

In DTD's one can say:

	<!ELEMENT elem (#PCDATA)>
	<!ATTLIST elem attr (enum1 | enum2 | enum3) #IMPLIED>

You can accomplish the same in schema with:

	<xs:element name='elem'>
		<xs:complexType mixed='true'>
			<xs:attribute name='attr'>
				<xs:simpleType>
					<xs:restriction base='xs:NMTOKEN'>
						<xs:enumeration
value='enum1'/>
						<xs:enumeration
value='enum2'/>
						<xs:enumeration
value='enum3'/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

pvb
Received on Friday, 15 February 2002 14:00:44 GMT

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