XML Schema field 元素
定义和用法
field 元素规定 XPath 表达式,该表达式指定用来定义标识约束(unique、key 和 keyref 元素)的值(或其中一个值)。
元素信息
出现次数 | 一次 |
父元素 | key、keyref、unique |
内容 | annotation |
语法
<field id=ID xpath=XPath expression any attributes > (annotation?) </field>
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
xpath | 必需。标识其内容或值用于约束的单个元素或属性。如果该表达式标识一个元素,则该元素必须是简单类型。 |
xml:lang | Optional. Specifies the language used in the content. |
(The ? symbol is declared within the field element, which can appear zero or one time.)
Instance
Example 1
The following example demonstrates a field element that defines the "userID" attribute as a field for identifying constraints:
<xs:field xpath="@userID"/>