users@jaxb.java.net

Re: Content model versus Element Model

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 21 Oct 2003 08:32:01 -0700

> I noticed that the amount is implemented as a BigDecimal as a property
> of the QUANTITYTypeImpl class, whereas in the element model, the
> QUANTITYAMOUNT is represented by it's own separate class ! Are both
> models used when you unmarhsal an XML doc. I.e. is there effectively two
> quantity amounts in memory at runtime.

Define QUANTITYAMOUNT as a local element. Because you defined it as a
global, there's a chance that you are going to unmarshal something like
this:

    <?xml version="1.0"?>
    <QUANTITYAMOUNT> 1.3 </QUANTITYAMOUNT>

The RI can never know if this is your intention or not, so it has to
generate QUANTITYAMOUNT element.

If you are not going to do this, you can just define this element
locally.

regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net