I am trying to read xsd
file and its throwing below 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
.
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. Get the element name that throws cvc-enumeration-valid
new StreamSource(new StringReader(xmlStr))
rather than going via a byte array - with your way, you run the risk of encoding problems. – Michael Kay