users@jaxb.java.net

Re: Bind existing class to existing schema HOWTO

From: Dmitri Colebatch <colebatchd_at_gmail.com>
Date: Tue, 21 Jun 2005 14:10:36 +1000

Thanks Sekhar, I'll update my page on the wiki as appropriate, a
couple of comments though:

On 6/21/05, Sekhar Vajjhala <Sekhar.Vajjhala_at_sun.com> wrote:
> >Step two - identify the root element for the class, add the
> >appropriate annotation to the top of the class:
> >
> > @XmlRootElement(name = "ElementName", namespace = "ElementNamespace")
> >
> A general comment that applies to all your steps below.
>
> Annotations elements are defaulted as far as possible to make them
> easier to use.

I understand that, I'm only really talking about the scenarios where
the defaults don't suit.

> This is important for Java -> schema since it reduces the amount of code
> that needs to be annotated by a devloper. So for e.g.
>
> @XmlRootElement Foo {...}

I assume you mean @XmlRootElement(name="Foo", ...)

> will by default associate a gobal element "foo" in the target namespace
> associated
> with the package containing the class foo.

I think I know what you're saying, for completeness you're talking
about section D5 of the spec, correct? I'm assuming the "..." above
is shorthand for the omitted propOrder option?

> For java->schema, JAXB 2.0 does really try to handle as many of the
> existing classes as possible.
> So non Javabeans can be handled using @XmlJavaTypeAdapter.
> By tweak are you talking about tweaking bits and pieces, are you
> referring to
> tweaking application code or adding annotations to get the desired
> XML/schema ?

The latter. In my case (and perhaps this could be fixed by a whole
bunch of intellij renaming) I have a bunch of classes where the
structure maps, but the names don't.

thanks again,
dim