aspose file tools*
The moose likes JBoss/WildFly and the fly likes how to convert  XMLGregorianCalendar datatype to java.util.Calendar datatype in JAX-W Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "how to convert  XMLGregorianCalendar datatype to java.util.Calendar datatype in JAX-W" Watch "how to convert  XMLGregorianCalendar datatype to java.util.Calendar datatype in JAX-W" New topic
Author

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

reddy kumar pavan
Greenhorn

Joined: Jul 01, 2007
Posts: 15
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

Joined: Apr 09, 2006
Posts: 1
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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to convert XMLGregorianCalendar datatype to java.util.Calendar datatype in JAX-W