You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Dario Arena (Jira)" <ji...@apache.org> on 2021/05/19 13:26:00 UTC
[jira] [Created] (CXF-8538) maven cxf-xjc-plugin ignores xjc:simple
in binding file for nested objects
Dario Arena created CXF-8538:
--------------------------------
Summary: maven cxf-xjc-plugin ignores xjc:simple in binding file for nested objects
Key: CXF-8538
URL: https://issues.apache.org/jira/browse/CXF-8538
Project: CXF
Issue Type: Bug
Components: JAXB Databinding
Affects Versions: 3.3.1
Environment: OS: Linux linux-mint-desktop 5.8.0-53-generic
Java: openjdk 11.0.11 2021-04-20 (using java 1.8 compatibility)
Maven: 3.6.3
Reporter: Dario Arena
I'm working on a project which requires creating xml files that conforms to an xsd schema and subsequently send these files using a SOAP service client.
To create java objects from the .xsd i'm using this configuration in pom.xml
{quote}<plugins>
...
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<additionalJvmArgs>-Djavax.xml.accessExternalDTD=all</additionalJvmArgs>
<sourceRoot>${basedir}/src-gen/main/java</sourceRoot>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/wsdls/Schema.xsd</xsd>
<extension>true</extension>
<bindingFile>${basedir}/src/main/resources/cxf-bindings.xml</bindingFile>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
{quote}
and my cxf-bindings.xml has this content:
{quote}<jaxb:bindings jaxb:version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc">
<jaxb:globalBindings generateElementProperty="false">
<jaxb:serializable uid="1"/>
<xjc:javaType name="java.time.LocalDateTime" xmlType="xs:dateTime" adapter="it.quantum.fatture.utils.XmlDateTimeConverter"/>
<xjc:javaType name="java.time.LocalDate" xmlType="xs:date" adapter="it.quantum.fatture.utils.XmlDateConverter"/>
<xjc:simple/>
</jaxb:globalBindings>
</jaxb:bindings>
{quote}
In the generated classes on the root element the extension <xjc:simple> is applied (the 'Type' suffix has been removed and a list member has the plural name 'invoiceBodies') but for nested complex types this seems to not have any effect (all the classes have names like 'InvoiceHeaderType', 'InvoiceBodyType' and so on and list members have the singular name).
Am i doing something wrong and maybe there is some configuration i am missing to recursively apply xjc:simple to all nested complex types?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)