RE: enumerations

> -----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 UTC