在xml模式中对字符串添加唯一的限制 [英] add unique restriction on string in xml schema
本文介绍了在xml模式中对字符串添加唯一的限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
假设我有以下代码:
Hello all,
Supposed I have this code :
<attribute name="id" use="required">
<simpleType>
<restriction base="ID"/>
</simpleType>
</attribute>
以ID为基础,我只能输入一个有效的名称(NCName)作为值. (例如id01)
有什么方法可以对xml模式中的字符串添加唯一的限制,以便我可以插入不符合有效名称的无效值? (例如01id)
With ID as a basis I can only enter a valid name(NCName) as value. (ex. id01)
Is there any way to add unique restriction on a string in xml schema so I could insert invalid values who do not fit the valid name? (ex. 01id)
推荐答案
您做错了:"ID"不是XSD类型.查看本章中的代码示例: http://www.w3schools.com/schema/el_restriction.asp [ ^ ];它会给您正确的想法.
—SA
You''re doing it wrong: "ID" is not an XSD type. Look at the code samples in this chapter: http://www.w3schools.com/schema/el_restriction.asp[^]; it will give you right idea.
—SA
这篇关于在xml模式中对字符串添加唯一的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文