users@jaxb.java.net

Re: External customization and duplicate classes with different name

From: Sekhar Vajjhala <Sekhar.Vajjhala_at_Sun.COM>
Date: Wed, 22 Jun 2005 13:39:38 -0400

Ranjith,R wrote:

>Hi,
>I am trying some external customization so that the generated
>classnames match my existing classes(I am doing a jaxb migration)
>
>I have the following XSD construct.
> <xsd:element name="Smaple_Protocl">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="LocInfo"/>
> <xsd:element ref="SampInfo"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> ........
> ........
> <xsd:element name="SampInfo">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="SE01"/>
> <xsd:element ref="SE02"/>
> </xsd:sequence>
> <xsd:attribute fixed="sample info trailer" name="desc"
>type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
>
>Now, in a binding xjb file I have the following line:
>...
><jxb:bindings node="//xsd:element[@name='SampInfo']">
><jxb:class name="Sample"/>
></jxb:bindings>
>...
>So my intention is to create class called "Sample.java". It gets
>generated also. But, the class created for element "Sample_Protocl",
>contains API getSampInfo(), which returns a class called "SampInfo".
>i.e; the signature is:
> public SampInfo getSampInfo()
>
>Where as I expected the getter method to be generated with following signature:
> public Sample getSampInfo()
>
I tried your example with an internal version of the JAXB RI that I have.
It does generate the above signature. If you are running an older version
of JAXB RI, perhaps you can try with a later version.

Also note if you want

         public Sample getSample()
instead of
         public Sample getSampInfo()

then you can the you can the JAXB <property> customization on
<element name="SampInfo">

Sekhar

>
>What xjb entry nees to be added? I guess the element
><jxb:bindings node="//xsd:element[@name='Sample_Protocl']> needs to
>have some reference to "Sample" instead of "Samp".
>
>If you have any Idea, let me know.
>
>Thanks in advance
>Ranjith
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
regards
Sekhar Vajjhala