I have an XML schema, where element Calling1 is defined like this:
<xsd:element name="Calling1" type="xsd:dateTime">
I have generated Jaxb bindings :
<xjc extension="true" schema="${basedir}/message.xsd"
destdir="${basedir}/src" package="org.test"/>
I am using JAXB to unmarshal XML documents to Java representation.
If my XML cantains element Calling1, which value is not a correct dateTime, for example
<Calling1>NOT_A_DATETIME</Calling1>
JAXB does not throw any error, but returns me an java object, which property calling1 is null.
Why i get null, and not an Error? How can i change that Jaxb behaviour?
Have you set the schema on your
Unmarshallerby callingsetSchema? You will need to specify the xsd file as well as the Schema NS URI for validation to take place