This element specifies information about the fields of a key (in the
usage scenario with tsd:unique
as parent) or fields to be
indexed within a compound index (in the usage scenario with
tsd:standard
as
parent).
It can be used in these two contexts:
In the context of tsd:unique
:
Purpose | In this context, the element specifies information about the fields of a key. |
Parent element | tsd:unique |
Child elements | None |
Attributes | xpath |
Name | Type | Description |
---|---|---|
xpath |
xs:string |
The The XPath expression is evaluated relative to the root element of the doctype being defined. Note that currently only paths consisting of "." or of the format ("/" element name)* "/" (element name | "@" attribute name) are allowed, but no filters. For more information on XPath, see the XML Path Language (XPath) Version 1.0 specification published by the W3C. |
This example demonstrates the use of the tsd:field
element
as a child element of tsd:unique
.
It contains the definition of one key using the "dot" option.
<tsd:doctype name="A"> . . . <tsd:unique name="root-key"> <tsd:field xpath="." /> </tsd:unique> . . . </tsd:doctype>
Here is another example of the tsd:field
element as a
child element of tsd:unique
:
<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>
It contains the definition of two keys:
CB-key
containing the fields C and
B/@b
D-key
containing the field D
In the context of tsd:standard
:
Purpose | This element specifies information about the fields to be indexed in a compound index. |
Parent element | tsd:standard |
Child elements | None |
Attributes | xpath |
Restriction | tsd:field may appear as a child of
tsd:standard only in the
scope of a tsd:elementInfo element, because
a compound index can be defined only for an element, not for an
attribute.
|
Name | Type | Description |
---|---|---|
xpath |
xs:string |
The Note: Valid
The XPath expression is evaluated relative to the element for which the compound index is being defined. Important: |
In this example, two compound indexes are created in addition to a "normal" text index and a "normal" standard index:
<xs:element ...> ... <tsd:elementInfo> <tsd:physical> [<tsd:which>...</tsd:which>] <tsd:native> <tsd:index> <tsd:text/> <tsd:standard/> <tsd:standard> <tsd:field xpath="C"/> <tsd:field xpath="B/@b" /> </tsd:standard > <tsd:standard> <tsd:field xpath="D"/> <tsd:field xpath="B/@b" /> </tsd:standard > ... </tsd:index> </tsd:native> </tsd:physical> </tsd:elementInfo> </xs:element>
These are:
an index with entries for every combination of C
and
B/@b
below the element;
an index with entries for every combination of D
and
B/@b
below the element.