I have xml File with element date type:
...
<startDate />
...
in xsd file this type is described:
<xs:element name="startDate " type="xs:date" nillable="true" />
When I validate xml with SchemaValidator I have an exception
org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: ” является недопустимым значением для ‘date’.
when tag startDate is not empty all is ok. But when it is empty exceptioin occur. I can only change xsd-schema file, but not xml, because I receive it from another system.
Since you cannot change the XML document, you could try to build a union type of xs:date with an empty string:
against which
should validate.
Note: If you could change your XML document, this would probably validate successfully against your original schema (because of the nillable attribute):