users@jaxb.java.net

Re: Best practices with JAXB and XML schema

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 14 Dec 2010 10:48:00 +0100

XML Schema is richer than Java - just look at all the facets. Therefore, the
schema derived from Java may not be so good for validation as a one
written by hand. But starting with Java classes has additional benefits,
since these classes may contain more than just the getters and setters, e.g.
equals, hashCode, toString and additional constructors. Staying close to the
style xjc generates Java code is usually a good idea, though.

If there is no XML schema defining an interface you must adjere to,
writing the Java classes by hand is a good starting point, and I've
seen it several times on this list.

-W



On 14 December 2010 07:52, DaHoopster-2 <hwang_at_myvest.com> wrote:

>
> Hi,
>
> In JAXB 1.0, the best practice or commonly adopted development process is
> to
> design the XSD first and generate the java classes. Now that JAXB 2.1 is
> out
> there and annotations make life a whole lot easier, does it make sense to
> approach the domain model from java classes and generate XSD's from the
> class hierarchy?
>
> I am taking the java classes first approach in my current project. Just
> wondering if this is a commonly adopted development model.
>
> Thanks...
> --
> View this message in context:
> http://old.nabble.com/Best-practices-with-JAXB-and-XML-schema-tp30452310p30452310.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>