Hi all,
I am trying to configure JAXB 2.1 binding file to generate a different
class name for one element in the schema.
For element called 'event-registry', I want the generated class to be called
EventRegistryConfiguration. For all other elements and type, I want the
default nameing used by JAXB 2.1
When I use the nameXmlTransform property, it appends 'Configuration' to all
class names generated. So I am close to what I want. Below is my .xjb file
so far.
Any thoughts on how to control the generated class names for one classes, or
a subset of classes ?
SAMPLE 1 - ALMOST WHAT I WANT....
<jxb:bindings>
<jxb:bindings schemaLocation="osr-event-registry.xsd"
node="/xsd:schema">
<jxb:schemaBindings>
<jxb:package name="nsw.osr.esb.conf.event.registry"/>
<jxb:nameXmlTransform>
<jxb:elementName suffix="Configuration"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jxb:bindings>
</jxb:bindings>
I have tried using (but it fails with errors). Combining both samples so
that schema details are the same fails also.
SAMPLE 2 - DOES NOT WORK
<jxb:bindings node="//xs:element[@name='event-register']">
<jxb:schemaBindings>
<jxb:nameXmlTransform>
<jxb:elementName suffix="Configuration"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jxb:bindings>
My environment: Windows, JDK 1.6.10, JAXB 2.1
Regards,
Serge
--
View this message in context: http://www.nabble.com/JAXB-2.1-XML-to-Java---Changing-generated-class-name-for-a-single-XML-element-tp20890301p20890301.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.