users@jaxb.java.net

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

From: Kenny MacLeod <kennym_at_kizoom.com>
Date: Wed, 12 Jul 2006 08:34:55 +0100

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?