You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The XML file I’m trying to validate against contains such tag with a value that I believe should be reported as wrong by the validation process (with woodstox-6.0.3):
<MyDate>2000-00-00</MyDate>
Instead, the incorrect value is not detected. If validated with other applications such as XmlSpy or other java parsers, the error is reported correctly.
I’m wondering if there’s a feature I’ve not set (something like lenient date) or it’s actually a bug.
Source code follows:
public void test() throws Exception {
File myFile = new File("myFile.xml");
File myXsd = new File("myXSD.xsd");
XMLInputFactory _xmlif = XMLInputFactory.newFactory();
XMLValidationSchemaFactory _xmlValidationSchemaFactory = XMLValidationSchemaFactory
.newInstance(XMLValidationSchema.SCHEMA_ID_W3C_SCHEMA);
try (FileInputStream fis = new FileInputStream(myFile);
BufferedInputStream bis = new BufferedInputStream(fis);) {
XMLStreamReader2 xmlStreamReader2 = (XMLStreamReader2) _xmlif.createXMLStreamReader(bis,
XmlConstants.UTF_8);
xmlStreamReader2.validateAgainst(_xmlValidationSchemaFactory.createSchema(myXsd));
while (xmlStreamReader2.hasNext()) {
xmlStreamReader2.next();
}
xmlStreamReader2.closeCompletely();
System.out.println("File valid");
} catch (XMLStreamException e) {
System.out.println("File NOT valid");
}
}
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered:
Hello all,
I’m trying to validate an XML file against its XSD schema (W3C) and I get an unexpected behaviour.
The XSD declares a tag of type
xs:date
as below defined:The XML file I’m trying to validate against contains such tag with a value that I believe should be reported as wrong by the validation process (with woodstox-6.0.3):
<MyDate>2000-00-00</MyDate>
Instead, the incorrect value is not detected. If validated with other applications such as XmlSpy or other java parsers, the error is reported correctly.
I’m wondering if there’s a feature I’ve not set (something like lenient date) or it’s actually a bug.
Source code follows:
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: