aspose file tools*
The moose likes XML and Related Technologies and the fly likes variations in generated classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "variations in generated classes" Watch "variations in generated classes" New topic
Author

variations in generated classes

Stuart Rogers
Ranch Hand

Joined: Oct 02, 2008
Posts: 133
So I'm trying to do a 'round-trip' ie starting with annotated Java classes, generating a schema with jaxb2-maven-plugin->schemagen then generating java classes from the schema using jaxb2-maven-plugin->xjc and in comparing the originals I discover some discrepencies. I have an adapter for changing XmlGregorianCalendar to JodaTime's DateTime baked into my bindings.xjb

The original files ExperimentA, B and C have a org.joda.time.DateTime attribute annotated three slightly different ways
ExperimentA

ExperimentB

ExperimentC


generating the schema results in
schema1.xsd


bindings.xjb


JodaDateTimeAdapter


running xjc generates new classes that slight different than each other
modExperimentA

modExperimentB

modExperimentC

with some extra generated classes appearing like DateTime, Adapter1 , etc

Notice only the third method produces a type of xs:dateTime which ties in with the bindings.xjb file.
And only the third method results in a generated class that imports the correct DateTime class.

Questions:
a: how can I get to where no extraneous classes get generated ie Adapter1 etc, and how can I
get my generated classes to both import org.joda.time.DateTime
and have only the " @XmlElement(name = " annotation? ie:


TIA,

Still-learning Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: variations in generated classes
 
Similar Threads
[JAXB] Not able to generate IMPL file using xjc
.xsd schema questions
can't create java objects from schemas using xjc
Need "ant" JAXB-GEN generated classes to automatically "implements Serializable"
JAXB: Two xsd - Create single JAXBContext