如何解决 cvc-pattern-valid: Value '' is not facet-valid respect to pattern 问题
How to resolve cvc-pattern-valid: Value '' is not facet-valid with respect to pattern problem
我正在尝试读取 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);
这个 validator.validate
(xmlFile) 部分正在抛出 exception
。
有什么想法吗?在此感谢您的帮助。
而且我已经查看了以下内容:
Value is not facet-valid with respect to pattern
您的 XSD 指定 Value
必须匹配不允许空字符串的指定正则表达式。
要么将 Value
更改为符合 XSD 正则表达式的非空值,要么将正则表达式更改为允许空字符串。
我正在尝试读取 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);
这个 validator.validate
(xmlFile) 部分正在抛出 exception
。
有什么想法吗?在此感谢您的帮助。
而且我已经查看了以下内容:
Value is not facet-valid with respect to pattern
您的 XSD 指定 Value
必须匹配不允许空字符串的指定正则表达式。
要么将 Value
更改为符合 XSD 正则表达式的非空值,要么将正则表达式更改为允许空字符串。