To specify restriction, a generalization must be used between this class and a super class. This generalization either has or does not have the XSDrestriction stereotype. Restriction id and annotation maps to Generalization properties.

In order to have an inner simpleType element, the parent of this Generalization must be the inner Class of the outer UML Class.

Restriction model example.
Restriction XML code sample
<xs:schema xmlns:nm = "http://nomagic.com" xmlns:xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://nomagic.com" >
<xs:simpleType name = "farenheitWaterTemp" >
		<xs:annotation >
			<xs:documentation >documentation of simple type</xs:documentation>
		</xs:annotation>
		<xs:restriction base = "xs:number" >
			<xs:annotation >
				<xs:documentation >documentation of restriction</xs:documentation>
			</xs:annotation>
			<xs:pattern id = "pattern_id" value = "[0-9]{5}(-[0-9]{4})?" >
				<xs:annotation >
					<xs:documentation >patterndoc</xs:documentation>

				</xs:annotation>
</xs:pattern>
			<xs:whiteSpace id = "white_spaceid" fixed = "true" value = "preserve" >
				<xs:annotation >
					<xs:documentation >white spacedoc</xs:documentation>
				</xs:annotation>
</xs:whiteSpace>
			<xs:whiteSpace id = "white_spaceid" fixed = "true" value = "preserve" >
				<xs:annotation >
					<xs:documentation >white spacedoc</xs:documentation>
				</xs:annotation>
</xs:whiteSpace>
			<xs:maxLength id = "maxlengthID" fixed = "false" value = "50" >
				<xs:annotation >
					<xs:documentation >max length documentation</xs:documentation>
				</xs:annotation>
			</xs:maxLength>
			<xs:minLength id = "minlengthID" fixed = "true" value = "2" >
				<xs:annotation >
					<xs:documentation >min length documentation</xs:documentation>
				</xs:annotation>
			</xs:minLength>
			<xs:length id = "lengthID" fixed = "true" value = "10" >
				<xs:annotation >
					<xs:documentation >length documentation</xs:documentation>
				</xs:annotation>
</xs:length>
			<xs:fractionDigits id = "fractionDigitsID" fixed = "true" value = "1" >
				<xs:annotation >
					<xs:documentation >fraction digits documentation</xs:documentation>
				</xs:annotation>
</xs:fractionDigits>
			<xs:totalDigits id = "totalDigitsID" fixed = "false" value = "8" >
				<xs:annotation >
					<xs:documentation >total digitsid</xs:documentation>
				</xs:annotation> 
</xs:totalDigits>
			<xs:maxInclusive id = "maxinclusiveid" fixed = "true" value = "100" >
				<xs:annotation >
					<xs:documentation >max inclusive documentation</xs:documentation>
				</xs:annotation>
			</xs:maxInclusive>
			<xs:minInclusive id = "mininclusiveid" fixed = "true" value = "100" >
<xs:annotation >
					<xs:documentation >min inclusive documentation</xs:documentation>
				</xs:annotation>
			</xs:minInclusive>
			<xs:maxExclusive id = "maxexclusiveid" fixed = "true" value = "101" >
				<xs:annotation >
					<xs:documentation >max exclusive documentation</xs:documentation>
				</xs:annotation>
</xs:maxExclusive>
			<xs:minExclusive id = "id" fixed = "true" value = "99" >
				<xs:annotation >
					<xs:documentation >min exclusive documentation</xs:documentation>
				</xs:annotation>
</xs:minExclusive>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name = "dayTime" >
<xs:annotation >
			<xs:documentation >day time documentation</xs:documentation>
		</xs:annotation>
		<xs:restriction >
			<xs:annotation >
				<xs:documentation >restriction documentation</xs:documentation>
			</xs:annotation>
			<xs:simpleType >
				<xs:restriction base = "xs:number" />
</xs:simpleType>
			<xs:enumeration value = "day" >
				<xs:annotation >
<xs:documentation >day value</xs:documentation>
				</xs:annotation>
‹/xs:enumeration>
			<xs:enumeration value = "night" >
				<xs:annotation >
<xs:documentation >night valuec</xs:documentation>
				</xs:annotation>
</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name = " sex" final = "restriction" >
		<xs:annotation >
			<xs:documentation >documentation of simple type restriction</xs:documentation>
		</xs:annotation>
		<xs:restriction base = "xs:string" >
			<xs:enumeration id = "some id" value = "male" /> 
<xs:enumeration value = "female" >
				<xs:annotation > 
<xs:documentation >female value</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
</xs:simpleType>
</xs:schema>