<jaxb:bindings version="2.0"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb";
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";>
    <jaxb:bindings  
schemaLocation="file:..\project_name_in_harddisk\wsdl\XYZ.xsd">
        <jaxb:bindings node="/xs:schema">
            <jaxb:globalBindings>
                <xjc:generateElementProperty>false</xjc:generateElementProperty>

                    <jaxb:javaType name="java.util.Calendar" 
xmlType="xs:dateTime"
                                
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
                                
printMethod="javax.xml.bind.DatatypeConverter.printDateTime"
                    />
                    <jaxb:javaType name="java.util.Calendar" xmlType="xs:date"
                                
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
                                
printMethod="javax.xml.bind.DatatypeConverter.printDate"
                    />

            </jaxb:globalBindings>
        </jaxb:bindings>
    </jaxb:bindings>
</jaxb:bindings>

I hope the above code snippet will solve your issue.especially look @ 
schemaLocation="file:..\project_name_in_harddisk\wsdl\XYZ.xsd"

-----Original Message-----
From: Bruce Edge [mailto:[email protected]]
Sent: Wednesday, June 10, 2009 7:17 PM
To: [email protected]
Subject: java.util.Calendar vs. XMLGregorianCalendar

In the config snippet on the wsdl2java docs page, 
http://cwiki.apache.org/CXF20DOC/wsdl-to-java.html

What does the "YOUR_SCHEMA_LOCATION" below refer to?
Is that a local file path or the path relative to the deployment directory ?

I assume that "schema" refers to the xsd that uses the xsd:dateTime ?

<jxb:bindings version="1.0"
              xmlns:jxb="http://java.sun.com/xml/ns/jaxb";
              xmlns:xs="http://www.w3.org/2001/XMLSchema";>
  <jxb:bindings schemaLocation="YOUR_SCHEMA_LOCATION" node="/xs:schema">
    <jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
      <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"

parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"

printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
    </jxb:globalBindings>
  </jxb:bindings>
</jxb:bindings>

Thanks, Bruce

Reply via email to