cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: How to have JAXB SchemaCompiler generating code for schema elements
Date Wed, 24 Feb 2010 17:04:20 GMT
On Wed February 24 2010 5:42:31 am Sergey Beryozkin wrote:
> Now, the compiler takes care of elements with anonymous complex types, but
> ignores elements referring to public complex types which probably makes
> sense but what does not make sense is that when generating the types only
> in this latter case it omits the @XmlRootElement.
> 
> It is probably not quite that straightforward but it's kind of limiting
> nonetheless, example, code-first - to - wadl/wsdl -back to code does not
> produce the same result, in other words, if we start from a source having
> types with @XmlRootElement the produced schema section will have elements
> referring to public complex types and now when we try to get back to the
> code we have types with no @XmlRootElements... Probably not a big deal for
> JAXRS-based services given that users can configure a JAXBElementProvider
> use JAXBElement under the hood and for real wadl-first cases we can
> recommend users doing elements  with anonymous types if needed.
> 
> Next question : when JAXBContext generates a schema, is it possible to
> configure it to optionally use anonymoos types, may work ok for cases when
> types are not reused across multiple diff elements...

You would need to add an @XmlType(name="") annotation to the type that also 
has the @XmlRootElement annotation on it.   That creates and element for it, 
but not a type so it ends up being anonymous.

Dan



> 
> cheers, Sergey
>   ----- Original Message -----
>   From: Sergey Beryozkin
>   To: dev@cxf.apache.org
>   Sent: Tuesday, February 23, 2010 5:02 PM
>   Subject: How to have JAXB SchemaCompiler generating code for schema
> elements
> 
> 
>   Hi
> 
>   I've started working on the wadl-first code generation (well not quite
> the wadl-first one yet...) and I'm using the code I've 'borrowed' from the
> DynamicClientFactory from cxf-rt-databinding-jaxb. At the moment I can
> only see files corresponding to schema types being generated. How can I
> configure SchemaCompiler to generate the code for xs:elements ?
> 
>   thanks, Sergey

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message