> -----Original Message-----
> From: Daniel Kulp [mailto:[email protected]]
> Sent: Monday, October 18, 2010 8:36 AM
> To: [email protected]
> Cc: KARR, DAVID (ATTSI)
> Subject: Re: Anyone know how to use "jxb:bindings" to change mappings
> to containers?
> 
> 
> I think you have to drop into an XJC plugin to accomplish this.
jaxb2-
> commons
> has one:
> 
> http://www.conspicio.dk/blog/bjarne/jaxb-xmlelementwrapper-plugin

Excellent.  That resolved the problem.  I forgot about JAXB plugins.

> On Saturday 16 October 2010 3:33:30 pm KARR, DAVID (ATTSI) wrote:
> > This isn't cxf-specific, but I would imagine people here would have
> run
> > into this:
> >
> > When I'm using Java-first mapping, I'm used to adding a pair of
> > annotations like the following:
> >
> >     @XmlElementWrapper(name = "services")
> >     @XmlElement(name = "service")
> >
> > In case I have a "List<Service> services" instance variable.  This
> > produces a more reasonable structure in the XML.
> >
> > However, I'm now trying to go in the other direction.  I have a
> > hand-coded schema with a "services" container and then a list of
> > "service" elements.  The default JAXB mapping produces a "services"
> > property of type "Services" class that has a "service" property that
> is
> > actually of type "list<Service>".  Ideally, I'd like this to work
> > exactly like the reverse direction, where it simply produces a
> > "List<Service> services" property, ignoring the "Services" class
> > entirely.
> >
> > I've read through the various pages that attempt to document the
> syntax
> > of the external binding file, but none of the examples cover what
I'm
> > trying to do here.
> >
> > I thought perhaps that this would do it (some info elided):
> >
> > -----------------------
> >     <jxb:bindings schemaLocation="<path to xsd>" node="/xsd:schema">
> >         <jxb:bindings node=".//xsd:eleme...@name='services']">
> >             <jxb:javaType name="List&lt;<package>.Service&gt;"/>
> >         </jxb:bindings>
> >     </jxb:bindings>
> > --------------------------
> >
> > This just fails with:
> >
> > [xjc] [ERROR] compiler was unable to honor this javaType
> customization.
> > It is attached to a wrong place, or its inconsistent with other
> > bindings.
> 
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog

Reply via email to