• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
reddy kumar pavan
Greenhorn
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:sequence>
<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:choice>
<xsd:element name="DeskTopCount" type="xsd:int"/>
<xsd:element name="NumberOfMailBoxes" type="xsd:int"/>
</xsd:choice>
<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"/>
</xsd:sequence>
</xsd:complexType>

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
Greenhorn
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="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:bindings>
<jxb:globalBindings>
<xjc:serializable uid="1" />
<jxb:javaType name="java.util.Calendar" xmlType="xs:date"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate" />
</jxb:globalBindings>
</jxb:bindings>
</jxb:bindings>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic