以下是验证失败的特定
XML标签:
<MiddleName>A</MiddleName>
该标签的XSD:
<xsd:element name="MiddleName" type="MiddleInitial" /> <xsd:simpleType name="MiddleInitial"> <xsd:restriction base="xsd:string"> <xsd:pattern value="^[A-Za-z]?$" /> </xsd:restriction> </xsd:simpleType>
我得到的错误:
cvc-pattern-valid: Value 'A' is not facet-valid with respect to pattern '^[A-Za-z]?$' for type 'MiddleInitial'.
我使用的验证器
http://tools.decisionsoft.com/schemaValidate/
正则表达式看起来不错. ^匹配开始,$,结束,?是字母A-Z或a-z的零或一倍.
有任何想法吗?
从w3规格
Regular Expressions (Appendix D):
…expressions are matched against entire lexical representations
rather than user-scoped lexical representations such as line and
paragraph. For this reason,the expression language does not contain
the metacharacters ^ and $,although ^ is used to express exception,
e.g. [^0-9]x
即拿出^和$.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。