XML Schema uniqueElement
Complete XML Schema Reference Manual
Definition and Usage
The unique element specifies that an attribute or element value (or a combination of attribute or element values) must be unique within the specified scope. The value must be unique or zero.
The unique element must contain the following elements in order:
- The selector element contains an XPath expression that specifies a set of elements within which the values specified by the field element must be unique. There must be one and only one selector element.
- Each field element contains an XPath expression that specifies the value (attribute or element value) that must be unique for the element set specified by the selector element.
If there are multiple field elements, the combination of field elements must be unique. In this case, the value of a single field element does not have to be unique for the selected elements, but the combination of all fields must be unique.
There must be one or more field elements.
Element Information
- Parent element: element
Syntax
<unique
id=ID
name=NCName
any attributes
>
(annotation?,(selector,field+))
</unique>
id=ID
name=NCName
any attributes
>
(annotation?,(selector,field+))
</unique>
(The ? symbol declares that this element can appear zero or one time within the unique element.)
| Attributes | Description |
|---|---|
| id | Optional. Specifies a unique ID for this element. |
| name | Required. Specifies a name for this element. |
| any attributes | Optional. Specifies any other attributes with a non-schema namespace. |
Complete XML Schema Reference Manual Other Extensions