什么是 xs:NCName 类型以及何时应该使用它? [英] What is an xs:NCName type and when should it be used?
问题描述
我通过模式生成器运行了我的一个 xml 文件,生成的所有内容都符合预期,除了一个节点:
I ran one of my xml files through a schema generator and everything generated was what was expected, with the exception of one node:
<xs:element name="office" type="xs:NCName"/>
xs:NCName
到底是什么?为什么要使用它,而不是 xs:string
?
What exactly is xs:NCName
? And why would one use it, rather xs:string
?
推荐答案
NCName 是非殖民名称,例如姓名".与限定名称的 QName 相比,例如ns:名称".如果你的名字不应该被不同的命名空间限定,那么它们就是 NCNames.
NCName is non-colonized name e.g. "name". Compared to QName which is qualified name e.g. "ns:name". If your names are not supposed to be qualified by different namespaces, then they are NCNames.
xs:string 对你的名字没有任何限制,但 xs:NCName 基本上不允许:"出现在字符串中.
xs:string puts no restrictions on your names at all, but xs:NCName basically disallows ":" to appear in the string.
这篇关于什么是 xs:NCName 类型以及何时应该使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!