users@jaxb.java.net

Re: Why JAXB do like this

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 29 Aug 2007 11:55:51 +0200

Hi.

> Hmmmmm,
>
> In J2EE 5 Tutorial I saw this code
>
>
> JAXBContext jc = JAXBContext.newInstance( "primer.po" );
>
> Unmarshaller u = jc.createUnmarshaller();
> PurchaseOrder po =
> (PurchaseOrder)u.unmarshal(
> new FileInputStream( "po.xml" ) ); In po.xsd
> <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
>
> And my structure the same. And in xsd I define only one element with
> PolicyIdenticalPublisher type

Note that it's not PurchaseOrderType, it's PurchaseOrder. It was
probably customized with
jaxb:globalBindings/_at_generateElementClass='true'. Still, generated
PurchaseOrder will extend JAXBElement<PurchaseOrderType>, which is not
different from what you'd get there initially. See spec 7.5.4.

Bye.
/lexi