-----Original Message-----
Sent: Friday, December 07, 2012 7:23 AM
Subject: Re: Why would XJC not generate a class for a root element?
In that case, it would be really useful to know which jaxb version you use
and to see the relevant parts of your Xsd..
I appear to have version 2.1.13 of jaxb-impl and jaxb-xjc.
Here is a slightly translated version of the relevant schema:
-------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.bar.com/automation/foo/schema/config/v1.0"
xmlns:tns="http://www.bar.com/automation/foo/schema/config/v1.0"
elementFormDefault="qualified">
<complexType name="fooConfigType">
<sequence>
<element name="workflowDefinitions" type="tns:workflowDefinitionsType"/>
<element name="channelDefinitions" type="tns:channelDefinitionsType"/>
</sequence>
<attribute name="apiversion" type="string" use="required"/>
</complexType>
<complexType name="workflowDefinitionsType">
<sequence>
<element name="workflowDefinition" type="tns:workflowDefinitionType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="channelDefinitionsType">
<sequence>
<element name="channelDefinition" type="tns:channelDefinitionType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="workflowDefinitionType">
<sequence>
<element name="queryFragment" minOccurs="1" />
<element name="queryOrder" minOccurs="1" type="int" />
</sequence>
<attribute name="id" type="ID" use="required" />
<attribute name="name" type="string" use="required" />
<attribute name="label" type="string" use="required" />
<attribute name="order" type="int" use="required" />
<attribute name="render" type="boolean" use="required" />
</complexType>
<complexType name="channelDefinitionType">
<sequence>
<element name="services" minOccurs="1">
<complexType>
<sequence>
<element name="service" type="tns:serviceType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</sequence>
<attribute name="name" type="string" use="required"/>
</complexType>
<complexType name="workflowAndThresholdsType">
<sequence>
</sequence>
<attribute name="workflow" type="IDREF" use="required"/>
<attribute name="yellow" type="float" use="required"/>
<attribute name="orange" type="float" use="required"/>
<attribute name="red" type="float" use="required"/>
</complexType>
<complexType name="serviceType">
<sequence>
<element name="handlers" minOccurs="1">
<complexType>
<sequence>
<element name="handler" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="perfThresholds" type="tns:perfThresholdsType" minOccurs="1"/>
<element name="workflows" minOccurs="1">
<complexType>
<sequence>
<element name="workflow" type="tns:workflowAndThresholdsType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</sequence>
<attribute name="id" type="ID" use="required"/>
<attribute name="label" type="string" use="required"/>
<attribute name="order" type="int" use="required"/>
</complexType>
<complexType name="perfThresholdsType">
<attribute name="yellow" type="int" use="required"/>
<attribute name="orange" type="int" use="required"/>
<attribute name="red" type="int" use="required"/>
</complexType>
<element name="fooConfig" type="tns:fooConfigType" />
</schema>
-------------------------------
Here's a small excerpt of "mvn -X", when it was parsing this schema and generating the code for it:
----------------------------
parsing a schema...
compiling a schema...
[INFO] generating code
unknown location
com\bar\foo\domain\config\ChannelDefinitionType.java
com\bar\foo\domain\config\ChannelDefinitionsType.java
com\bar\foo\domain\config\ObjectFactory.java
com\bar\foo\domain\config\PerfThresholdsType.java
com\bar\foo\domain\config\ServiceType.java
com\bar\foo\domain\config\FooConfigType.java
com\bar\foo\domain\config\WorkflowAndThresholdsType.java
com\bar\foo\domain\config\WorkflowDefinitionType.java
com\bar\foo\domain\config\WorkflowDefinitionsType.java
com\bar\foo\domain\config\package-info.java
-----------------------------
It generated "FooConfigType.java", but not "FooConfig".
And here is my plugin reference. Note that I am processing 3 other schemas besides this one, but they are all going into different packages. I'm using a locally-built version of the "element wrapper plugin".
-------------------------------------
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.6.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<extensions>
<extension>JAXBXMLElementWrapperPlugin:JAXBXMLElementWrapperPlugin:1.0.0</extension>
</extensions>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/schema/serviceCallResults.xsd</xsd>
<packagename>com.bar.foo.domain.serviceCallResults</packagename>
<extension>true</extension>
<extensionArgs>
<extensionArg>-Xxew</extensionArg>
<extensionArg>-summary ${basedir}/target/xew-summary.txt</extensionArg>
<extensionArg>-instantiate lazy</extensionArg>
</extensionArgs>
</xsdOption>
<xsdOption>
<xsd>${basedir}/src/main/resources/schema/dataProblems.xsd</xsd>
<packagename>com.bar.foo.domain.dataProblems</packagename>
<extension>true</extension>
<extensionArgs>
<extensionArg>-Xxew</extensionArg>
<extensionArg>-summary ${basedir}/target/xew-summary.txt</extensionArg>
<extensionArg>-instantiate lazy</extensionArg>
</extensionArgs>
</xsdOption>
<xsdOption>
<xsd>${basedir}/src/main/resources/schema/serviceAutoRateCallResults.xsd</xsd>
<packagename>com.bar.foo.domain.autorate</packagename>
<extension>true</extension>
<extensionArgs>
<extensionArg>-Xxew</extensionArg>
<extensionArg>-summary ${basedir}/target/xew-summary.txt</extensionArg>
<extensionArg>-instantiate lazy</extensionArg>
</extensionArgs>
</xsdOption>
<xsdOption>
<xsd>${basedir}/src/main/resources/schema/fooConfig.xsd</xsd>
<packagename>com.bar.foo.domain.config</packagename>
<extension>true</extension>
<extensionArgs>
<extensionArg>-Xxew</extensionArg>
<extensionArg>-summary ${basedir}/target/xew-summary.txt</extensionArg>
<extensionArg>-instantiate lazy</extensionArg>
</extensionArgs>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
----------------------
Post by KARR, DAVID-----Original Message-----
Sent: Thursday, December 06, 2012 10:18 PM
Subject: Re: Why would XJC not generate a class for a root element?
Is the name of the root element and its complex type the same?
Xjc generates 1 class file for xsd document named after the root element
and then separate file for each complexType. If the complextType
name
Post by KARR, DAVIDis
the same as root element name, the root element file is
overwritten..
Post by KARR, DAVIDI never do that. My type names always end with "Type".
The base name of my schema file name is the same as the root element,
and
Post by KARR, DAVIDthe type of the root element has "Type" appended to the name. XJC
generated the class for the "Type", but not the root element.
Post by KARR, DAVIDI have a JAX-RS app that uses XJC to generate classes from 4
different
Post by KARR, DAVIDschemas. All four xjc calls in the pom reference a binding file
specific
Post by KARR, DAVIDto that schema. All 4 schemas are pretty simple, along with very
similar
Post by KARR, DAVIDbinding files, and the reference in the pom. They all define a
single
Post by KARR, DAVIDtop-level "element" element, along with several complexType
elements.
Post by KARR, DAVIDPost by KARR, DAVIDFor some reason, the processing of one of those schemas is
refusing
Post by KARR, DAVIDto
Post by KARR, DAVIDgenerate the class corresponding to the root element. I have a
complexType
Post by KARR, DAVIDthat the element references, and it generated the class for that,
but
Post by KARR, DAVIDnot
Post by KARR, DAVIDfor the element. The other three schemas get the generated class
corresponding to the root element.
There are no processing errors.
I'd like to get a solution, but is there some additional
debugging I