[英]How to resolve cvc-pattern-valid: Value '' is not facet-valid with respect to pattern problem
I am trying to read xsd
file and its throwing below exception
: 我正在尝试读取
xsd
文件及其以下exception
:
cvc-pattern-valid: Value '' is not facet-valid with respect to pattern '[1-2][0-9]{3,3}(((0[1-9])|(1[0-2]))((0[1-9])|([0-2][0-9]|3[0-1])(([0-1][0-9]|2[0-3])([0-5][0-9]([0-5][0-9](\.[0-9]{1,4})?)?)?)?)?)?([+\-](0[0-9]|1[0-3])([0-5][0-9]))?' for type '#AnonType_valueTS'.
final Schema schema = schemaFactory.newSchema(this.getClass().getClassLoader().getResource("/schemaorg_apache_xmlbeans/src/mySchema.xsd"));
final Validator validator = schema.newValidator();
final StreamSource xmlFile = new StreamSource(new ByteArrayInputStream(xmlString.getBytes("utf-8")));
validator.validate(xmlFile);
This validator.validate
(xmlFile) part is throwing exception
. 这个
validator.validate
(xmlFile)部分抛出exception
。
Any Idea? 任何想法? Appreciate your kind help here.
在这里感谢您的帮助。
and I have already looked in to below: Value is not facet-valid with respect to pattern 并且我已经查看以下内容: 就模式而言,值不是有效的
Validating xml. 验证xml。 Get the element name that throws cvc-enumeration-valid
获取引发cvc-enumeration-valid的元素名称
Your XSD specifies that Value
must match a specified regular expression that does not allow an empty string. 您的XSD指定
Value
必须与不允许空字符串的指定正则表达式匹配。
Either change Value
to be a non-empty value that conforms to the XSD's regex, or change the regex to allow an empty string. 将
Value
更改为符合XSD的正则表达式的非空值,或者将正则表达式更改为允许空字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.