Discussion:
Problems with cxf-xjc-plugin
fitzcaraldo
2012-06-03 00:24:44 UTC
Permalink
Hi

I am trying to get a simple xsd2java example working using an external jaxb
bindings file to change the default Calendar format

My pom looks like this:

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.3.0</version>
<configuration>
<extensions>

<extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
</extensions>
</configuration>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/GBO.xsd</xsd>
<bindingFile>${basedir}/src/main/resources/simple.xjb</bindingFile>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>

The bindings file is as follows:


<jaxb:bindings jaxb:version="2.0"
jaxb:extensionBindingPrefixes="xjc"
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:globalBindings>
<xjc:simple />
<jaxb:javaType name="java.util.Calendar" xmlType="xs:date"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate" />
<jaxb:javaType name="java.util.Calendar" xmlType="xs:time"
parseMethod="javax.xml.bind.DatatypeConverter.parseTime"
printMethod="javax.xml.bind.DatatypeConverter.printTime" />
<jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
</jaxb:globalBindings>
</jaxb:bindings>


The generate-sources goal fails with the following

[INFO] --- cxf-xjc-plugin:2.3.0:xsdtojava (generate-sources) @ RB_GBO_SO_GG
---
[ERROR] vendor extension bindings (jaxb:extensionBindingPrefixes) are not
allowed in the strict mode. Use -extension.
line 1 of
file:/C:/prj/mungo/samples/RB_GBO_SO_GG/src/main/resources/GBO.xsd

What have I missed?


--
View this message in context: http://cxf.547215.n5.nabble.com/Problems-with-cxf-xjc-plugin-tp5709012.html
Sent from the cxf-user mailing list archive at Nabble.com.
Daniel Kulp
2012-06-06 17:52:07 UTC
Permalink
Not sure about the 2.3.0 version of the plugin, but the 2.6.0 version would
allow an <extension>true</extension> element in the xsdOption element to
turn on the extensions that would be needed for this to work.

Dan
Post by fitzcaraldo
Hi
I am trying to get a simple xsd2java example working using an external
jaxb bindings file to change the default Calendar format
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.3.0</version>
<configuration>
<extensions>
<extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
</extensions>
</configuration>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/GBO.xsd</xsd>
Post by fitzcaraldo
<bindingFile>${basedir}/src/main/resources/simple.xjb</bindingFile>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
<jaxb:bindings jaxb:version="2.0"
jaxb:extensionBindingPrefixes="xjc"
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:globalBindings>
<xjc:simple />
<jaxb:javaType name="java.util.Calendar" xmlType="xs:date"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate" />
<jaxb:javaType name="java.util.Calendar" xmlType="xs:time"
parseMethod="javax.xml.bind.DatatypeConverter.parseTime"
printMethod="javax.xml.bind.DatatypeConverter.printTime" />
<jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
</jaxb:globalBindings>
</jaxb:bindings>
The generate-sources goal fails with the following
RB_GBO_SO_GG ---
[ERROR] vendor extension bindings (jaxb:extensionBindingPrefixes) are not
allowed in the strict mode. Use -extension.
line 1 of
file:/C:/prj/mungo/samples/RB_GBO_SO_GG/src/main/resources/GBO.xsd
What have I missed?
--
http://cxf.547215.n5.nabble.com/Problems-with-cxf-xjc-plugin-tp5709012.ht
ml Sent from the cxf-user mailing list archive at Nabble.com.
--
Daniel Kulp
dkulp-1oDqGaOF3Lkdnm+***@public.gmane.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com
Loading...