Maps to a UML Attribute added into some UML Class.

  • refer – to value of “refer” or “referString” TaggedValue.
  • name – to Attribute name.
  • id – to TaggedValue.
keyref Mapping to UML attributes
<keyref
	id = ID
	name = NCName
refer = OName
{any attributes with non-schema namespace…}>
	Content: (annotation?, (selector, field+))
</keyref>

keyref UML model example.
keyref XML code sample
<xs:schema xmlns:nm = "http://nomagic.com" xmlns:xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://nomagic.com" >
<xs:element name = "vehicle">
		<xs:complexType>
<xs:all />
			<xs:attribute name = "plateNumber" type = "xs:integer" />
<xs:attribute name = "state" type = "nm:twoLetterCode" />
		</xs:complexType>
	</xs:element>
	<xs:element name = "state">
		<xs:complexType>
			<xs:sequence>
				<xs:element name = "code" type = "nm:twoLetterCode" /›
<xs:element ref = "nm:vehicle" maxOccurs = "unbounded" />
				<xs:element ref = "nm:person" maxOccurs = "unbounded" />
			</xs:sequence>
</xs:complexType>
		<xs:unique name = "reg" >
			<xs:annotation >
				<xs:documentation>unique documentation</xs:documentation>
			</xs:annotation>
			<xs:selector xpath = ".//vehicle" />
			<xs:field xpath = "@plateNumber" />
		</xs:unique>
	</xs:element>
	<xs:element name = "person"> 
<xs:complexType>
			<xs:sequence>
				<xs:element name = "car">
					<xs:complexType>
						<xs:sequence />
						<xs:attribute name "regPlate" type = "xs:integer" />
						<xs:attribute name = "regState" type = "nm:twoLetterCode" />
					</xs:complexType>
				</xs:element>
			</xs:sequence>
</xs:complexType>
	</xs:element>
	<xs:element name = "root"> 
<xs:complexType>
			<xs:sequence>
<xs:element ref = "nm:state" maxOccurs = "unbounded" />
			</xs:sequence>
</xs:complexType>
		<xs:key name = "state" >
			<xs:selector xpath = ".//state" />
			<xs:field xpath = "code"
		</xs:key>
		<xs:keyref name = "vehicleState" refer = "nm:state" >
<xs:selector xpath = ".//vehicle" />
			<xs:field xpath = "@state" />
		</xs:keyref>
		<xs:key name = "regKey">
<xs:annotation>
				<xs:documentation>key documentation</xs:documentation>
</xs:annotation>
<xs:selector xpath = ".//vehicle" />
			<xs:field xpath = "@state" />
			<xs:field xpath = "@plateNumber" />
		</xs:key>
		<xs:keyref name = "carRef" refer = "nm:regKey">
			<xs:annotation>
<xs:documentation>key ref documentation</xs:documentation>
			</xs:annotation>
			<xs:selector xpath = ".//car" /> 
<xs:field xpath = "@regState" />
<xs:field xpath = "@regPlate" />
		</xs:keyref>
	</xs:element>
	<xs:simpleType name = "twoLetterCode">
<xs:restriction base = "xs:string" />
</xs:simpleType>
</xs:schema>