Reputation: 33
I am using jaxb2-maven-plugin xjc to generate java classes from xsd schema (example here: https://www.baeldung.com/jaxb ). Which works.
Secondly I am using com.fasterxml.jackson.dataformat.xml.XmlMapper to deserialize XML file to Java object, but during deserialzation i got following error(i tried to delete this attribute and all other attributes were OK):
ObjectMapper no String-argument constructor/factory method to deserialize from String value ('1993-08-25')
Problem is with this generated java attribute:
@XmlElement(name = "Created", required = true)
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar created;
In XML:
<ns2:Created>1993-08-25</ns2:Created>
I tried to set date format to xml mapper
xmlMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
,
but it didnt work.
Upvotes: 1
Views: 410