0

I have created some element names with dateTime type and date type also, I have mentioned the date and dateTime in jaxb Bindings.xml file with Global scope, Its working fine. Jaxb bindings.xml file

<jaxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <jaxb:globalBindings generateIsSetMethod="true" fixedAttributeAsConstantProperty="true" localScoping="toplevel" generateElementProperty="false" collectionType="indexed">
        <jaxb:javaType name="java.util.Calendar" xmlType="xs:date" parseMethod="javax.xml.bind.DatatypeConverter.parseDate" printMethod="javax.xml.bind.DatatypeConverter.printDate" />
        <jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
        <xjc:serializable uid="1" />
    </jaxb:globalBindings>
</jaxb:bindings>

I am getting the out put for all the elements. But it's not showing proper response dateTime in desire way.

Its showing like this

2014-09-11T03:58:25+05:30

But I want with milleseconds also like

2014-09-11T03:58:25.000+05:30  

there is no much different just mille seconds are missing in current out put how do it. In which class I need to override or write new method for this.

lexicore
  • 42,748
  • 17
  • 132
  • 221
Faisal
  • 1,469
  • 2
  • 13
  • 25

1 Answers1

0
  • Implement your converter as static print/parse methods - or better implement an adapter (subclass XmlAdapter).
  • Use jaxb:javaType or (better) xjc:javaType customization to configure your adapter. See the following question for example:

Set an XJC javaType adapter in external binding file

Community
  • 1
  • 1
lexicore
  • 42,748
  • 17
  • 132
  • 221