users@jaxb.java.net

Re: JaxB and DOM dictionary & JAXB Customization

From: Ed Mooney <Ed.Mooney_at_sun.com>
Date: Thu, 05 Jun 2003 17:42:47 -0400

Hi J?r?me,

You can either write a superclass that all JAXB-generated classes
extend, or write a subclasses that extend a JAXB-generated classes. See
samples/vendor-extensions (examples/vendor-extensions in 1.0) for the
first option.

For the second option, see
http://java.sun.com/xml/jaxb/extendingJaxbGeneratedClasses.html. This
describes a two-step compilation that's no longer necessary in JAXB
1.0.1. E.g., if you unzip
http://java.sun.com/xml/jaxb/subclass-workaround.zip and delete these
two lines from subclass-workaround-inline/build.xml:

41,42d42
     < <xslt in="address.xsd" out="addressPrime.xsd"
style="stripImplClass.xsl"/>
     < <xjc schema="addressPrime.xsd" target="."/>

everything just works.

Regards,
--
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
CANDAT Jerome wrote:
> Hello everyone,
>
> Personaly, I'm interested in your approach. Could you give me some more
> details please?
>
> I also have another question concerning JAXB. I want to use the JAXB
> generated classes directly in my SWING components. The Swing components use
> a toString method on the objects to display. I would like the swing
> components to display the "name" attribute of my XML elements. In the
> generated classes, I have the getName and setName method defined. I'd like
> to define another method called toString() that has the same behaviour as
> the getName method.  I'd like JAXB to generate this method for me directly
> and not having to derive the generated classes.
> Is it possible to do this?
>
> Thanks in advance,
> J?r?me.
>
[ ... ]