Purpose |
This element specifies that a field is to be a unique key, as
described in the section Definition of Unique
Keys of the Tamino XML Schema User
Guide. If present, checks on uniqueness are performed for
the single key or combination of keys that are specified in the
|
Parent element | tsd:logical |
Child elements |
Note: |
Attributes | name |
Restrictions |
The
|
Name | Type | Description |
---|---|---|
name |
xs:NCName |
This required attribute specifies the name of the uniqueness constraint under which it can subsequently be referenced. The name must be unique within the scope of a single doctype. |
This example demonstrates the use of the tsd:unique
element
and its subelement tsd:field
to define two unique keys. One unique key definition is intended for the
combined key comprising the element C
and the
attribute b
of element
B
. The other one is intended for a single key
consisting of the element D
.
<tsd:doctype name="A"> . . . <tsd:unique name="CB-key"> <tsd:field xpath="C" /> <tsd:field xpath="B/@b" /> </tsd:unique> <tsd:unique name="D-key"> <tsd:field xpath="D" /> </tsd:unique> . . . </tsd:doctype>
Here is another example for the tsd:unique
element. It shows
how to impose a uniqueness constraint on the root element of the schema.
<tsd:doctype name="A"> . . . <tsd:unique name="root-key"> <tsd:field xpath="." /> </tsd:unique> . . . </tsd:doctype>