users@jaxb.java.net

Re: jaxb1 problem with complex-types vs elements

From: Christoph Sturm <christoph.sturm_at_gmail.com>
Date: Mon, 26 Jun 2006 23:30:41 +0200

Hey Ed!

My only issue with this behavior is this:

<element name="x" type="y"/> generates code like this:

class X extends Y

and thus every setter that takes an argument of Y can als be invoked
with an instance of type X. And there goes my typesafety.

If X would not extend Y everything would be fine, and i would get a
compiler error.

do you understand my issue?

regards
 chris
On 6/26/06, Ed Mooney <Ed.Mooney_at_sun.com> wrote:
> Hi Christoph,
>
> JAXB doesn't inhibit your building up invalid content trees in memory,
> which is what you're doing. If the RI supported "fail-fast validation"
> (an optional feature of the spec), it might tell you sooner (that your
> content tree is invalid) but, as it is, it tells you at unmarshal time.
> Please let me know if I've misunderstood.
>
> 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
>
> Christoph Sturm wrote:
> > hey ed!
> >
> > attached you find a schema and a testcase.
> >
> > this is the part of my ant file that compiles the schemas.
> > put the xsd file into a dir named xsd, and it should all work.
> >
> > <target name="xjc" depends="init">
> > <xjc target="target/xjc" package="cc.lovo.types" extension="true">
> > <schema dir="xsd">
> > <include name="*.xsd"/>
> > </schema>
> > </xjc>
> > </target>
> >
> >
> > thanks for looking at it!
> >
> > regards
> > chris
> >
> [ ... ]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
christoph.sturm_at_gmail.com