如何解决 cvc 模式有效:值在模式问题上不是分面有效的



我正在尝试读取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

知道吗?感谢您在这里的帮助。

我已经在下面查看过: 值对于模式
不是分面有效的

验证 xml。获取引发 cvc 枚举有效的元素名称

XSD 指定Value必须与不允许空字符串的指定正则表达式匹配。

Value更改为符合 XSD 正则表达式的非空值,或更改正则表达式以允许空字符串。

最新更新