users@jaxb.java.net

Re: mixed="true", JAXBElement and List<Serializable>

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 12 Jul 2006 16:31:41 -0700

Kenny MacLeod wrote:
> Kohsuke Kawaguchi wrote:
>> Kenny MacLeod wrote:
>>> As a follow-on to this problem, I need a halfway-decent way to
>>> construct a List<Serializable> of JAXBElement objects for later
>>> marshalling. At the level of code which uses the JAXB binding, there
>>> is no access to the QName or namespace of the schema, making it
>>> difficult to construct JAXBElement objects.
>>>
>>> My initial thought it to use reflection to look at the @XmlElementRefs
>>> annotations at runtime, and infer the required QName from that, but
>>> that seems like a rather backdoor way of going about things.
>>>
>>> Any other suggestions?
>>
>> What if you just customize the schema compilation process that you get
>> List<JAXBElement<?>> property to begin with, as opposed to
>> List<Serializable>?
>
> That wouldn't seem to address the problem of constructing the
> JAXBElement objects myself, though. Or am I missing something?

Maybe I'm misunderstanding your question, then. Maybe you want to create
JAXBElement<List<Object>> ?


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com