xml schema 中如何定义类似Map的结构

利用xs:unique关键字。在xs:element里添加unique节点,任意命名,然后用xs:selector来选择需要唯一的域, xs:field 里指定特定的字段。


例如:定义所有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 >

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念