xml - Unmarshalling custom date to XMLGregorianCalendar -


we unmarshalling date field using jaxb. format coming in xml

2013-10-07 03:57:36.703

in dto class, field value has populates looks

@xmlelement(name = "valid_to", required = true) @xmlschematype(name = "date") protected xmlgregoriancalendar validto; 

but, after unmarshalling, don't in valito.

in xsd, valid_to has custom xsd:date mapping pattern[0-9]{4}-[0-9]{2}-[0-9]{2}

is necessary have timezone in value able convert xmlgregoriancalendar ?

thanks !!!

the following formats work jaxb , xmlgregoriancalendar out of box.

  • xsd:date - 2013-10-07
  • xsd:datetime - 2013-10-07t03:57:36.703

if want alternate format such 2013-10-07 03:57:36.703 can use xmladapter.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -