xml schema 中如何定义类似Map的结构
发布时间:2020-12-16 05:25:15 所属栏目:百科 来源:网络整理
导读:利用xs:unique关键字。在xs:element里添加unique节点,任意命名,然后用xs:selector来选择需要唯一的域, xs:field 里指定特定的字段。 例如:定义所有Item里的Key为唯一, xs:complexType xs:sequence minOccurs =" 0 " maxOccurs =" unbounded " xs:eleme
例如:定义所有Item里的Key为唯一,
<
xs:complexType
>
<
xs:sequence
minOccurs
="
0
"
maxOccurs
="
unbounded
">
<
xs:element
name
="
Item
"
type
="
IdentifiersWithSourceItemType
">
</
xs:element
>
</
xs:sequence
>
</
xs:complexType
>
<
xs:unique
name
="
KeyUnique
">
<
xs:selector
xpath
="
.//Key
"/>
<
xs:field
xpath
="
.//NamespaceID
"/>
</
xs:unique
>
<
xs:unique
name
="
KeyUnique2
">
<
xs:selector
xpath
="
.//Key
"/>
<
xs:field
xpath
="
.//UniversalIDType
"/>
<
xs:field
xpath
="
.//Universal/UniversalID
"/>
</
xs:unique
>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |