users@jaxb.java.net

Re: List<Item> customization

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 08 Jun 2006 15:55:11 -0700

Victor Glushenkov wrote:
> But XJC compiler give following error:
>
> [ERROR] compiler was unable to honor this property customization. It
> is attached to a wrong place, or its inconsistent with other bindings.
>
> Could someone tell how to fix it?
> Maybe there is another way to solve my problem?

Attach the customization to the sequence, not element. Try this:

<jxb:bindings node="//xs:complexType[@name='RecipientList']">
   <jxb:bindings node="./xs:sequence">
     <jxb:property name="recipients" />

This is because XJC is binding the <sequence> (which is what's
repeated), not <element> in this case.

XJC is fairly stupid in this case, but making this work nicely in
general is a hard problem.

Also, since you are trying to use a plural form for properties. I think
you might find this JAXB RI vendor extension [1] useful.

[1]
https://jaxb.dev.java.net/nonav/2.0.1/docs/vendorCustomizations.html#simple
-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com