users@jaxb.java.net

Re: Wrapper element splitted in different list

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Sat, 31 Oct 2009 19:46:48 +0100

You are not showing or describing how <a> and <b> occur within <wrapper>. If
they occur in any (mixed) order, you won't be able to separate them into two
lists since this would not reflect the order in which these elements occur
in the XML document. This list will then be List<JAXBElement<?>> and can be
processed easily by looking at the "name" property of JAXBElement.

If all <a> elements precede (or follow) all <b>, then declare another class
for <wrapper> with lists for <a> and <b>.

--W

On Sat, Oct 31, 2009 at 5:22 PM, Michenux <lmichenaud_at_adeuza.fr> wrote:

>
> Hi,
>
> I have a list :
> <bean>
> <wrapper>
>
>
>
>
>
> </wrapper>
> </bean>
>
> I want to map to a different list for each kind of elements, so i did :
>
> public class Bean {
>
> @XmlElementWrapper(name="wrapper")
> @XmlElement(name="a")
> private List listA ;
>
> @XmlElementWrapper(name="wrapper")
> @XmlElement(name="b")
> private List listB ;
> }
>
> My problem is that only the listA is populated and listB is null.
> If i comment the field listA in the bean, the listB is well populated.
>
> So, i think i'm doing wrong or maybe it is not possible.
>
> Thanks for helping.
>
>
> --
> View this message in context:
> http://old.nabble.com/Wrapper-element-splitted-in-different-list-tp26143797p26143797.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>