keyref

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XML Schemas

keyref

Specifies that an attribute or element value (or set of values) correspond to those of the specified key or unique element.

<keyref
  id = ID 
  name = NCName 
  refer = QName
  {any attributes with non-schema Namespace}…>
Content: (annotation?, (selector, field+))
</keyref>

Attributes

id
The ID of this element. The id value must be of type ID and be unique within the document containing this element.

Optional.

name
The name of the keyref element. The name must be a no-colon-name (NCName) as defined in the XML Namespaces specification.

The name must be unique within an identity constraint set.

Required.

refer
The name of a key or unique element defined in this schema (or another schema indicated by the specified namespace). The ref value must be a qualified name (QName). The type can include a namespace prefix.

Required.

Element Information

Number of occurrences One time
Parent elements element
Contents annotation, field, selector

Remarks

The keyref element must contain the following elements in order.

selector The selector element contains an XML Path Language (XPath) expression specifying the set of elements across which the values specified by field must be unique.

There must be one and only one selector element.

field Each field element contains an XPath expression specifying the values (attribute or element values) that must be unique for the set of elements specified by the selector element.

If there is more than one field element, the combination of the field elements must be unique. In this case, the values for a single field element may or may not be unique across the selected elements but the combination of all the fields must be unique.

There must be one or more field elements.

Example

For an example, see key.

See Also

XML Schema Reference (XSD) | XML Schema Elements

For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-keyref.

Other Resources Other Resources

W3C Namespaces in XML Recommendation