You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by fitzcaraldo <br...@marlo.com.au> on 2012/06/03 02:24:44 UTC
Problems with cxf-xjc-plugin
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.
Re: Problems with cxf-xjc-plugin
Posted by Daniel Kulp <dk...@apache.org>.
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
On Saturday, June 02, 2012 05:24:44 PM fitzcaraldo wrote:
> 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.ht
> ml Sent from the cxf-user mailing list archive at Nabble.com.
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com