• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
You may have just won ten million dollars! Or, maybe a tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic