Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to convert XMLGregorianCalendar datatype to java.util.Calendar datatype in JAX-W  RSS feed

reddy kumar pavan
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am migrating webservice from weblogic to JBoss 4.2.1.
Weblogic uses internally XMLBeans for generation of schema related classes and for migration to JBOSS i have used JAXB 2.0.
I have the following complex element in XSD

<xsd:complexType name="Bundle">
<xsd:element name="XMLParseStatus" type="XMLParseStatus" minOccurs="0"/>
<xsd:element name="PartnerGeneratedOrderID" type="xsd:int"/>
<xsd:element name="ProductType" type="xsd:string"/>
<xsd:element name="AutoRenewalFlag" type="xsd:int" minOccurs="0"/>
<xsd:element name="OrderDate" type="xsd ate"/>
<xsd:element name="DeskTopCount" type="xsd:int"/>
<xsd:element name="NumberOfMailBoxes" type="xsd:int"/>
<xsd:element name="SubscriptionLength" type="xsd:int"/>
<xsd:element name="ServiceLevel" type="xsd:int"/>
<xsd:element name="PaymentType" type="xsd:int"/>
<xsd:element name="ProductLanguageCode" type="xsd:string" minOccurs="0"/>

For Order Date
XMLBeans creates java.util.Calendar datatype
JAXB generates javax.xml.bind.XMLGregarionCalendar datatype

i have to Requirement where i have to use java.util.Calendar.

Is there any way that OrderDate datatype can be javax.xml.bind.XMLGregarionCalendar.

Please help me.

Thanks in Advance.
manoj jaiswal
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use JaXB Binding xml

<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="2.0" xmlns:jxb=""
<xjc:serializable uid="1" />
<jxb:javaType name="java.util.Calendar" xmlType="xs:date"
printMethod="javax.xml.bind.DatatypeConverter.printDate" />
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!