JAXB Wrapped Collections

I have a class containing two lists. I want to create a wrapper element around list items and around two lists.

class SomeClass {

   private List<TypeA> listA;
   private List<TypeB> listB;

}

<some-class>
    <lists>
        <list-a>
            <element-from-list-a />
            <element-from-list-a />
            <element-from-list-a />
            ...
        </list-a>

        <list-b>
            <element-from-list-b />
            <element-from-list-b />
            <element-from-list-b />
            ...
        </list-b>
    </lists>
</some-class>

I can create a wrapper around a list using xml-element-wrapper, but I cannot wrap two lists in one element.

Is it possible to do this in JAXB and / or in the moxy implementation?

+5
source share
1 answer

After I asked the question, I successfully solved the problem with the moxy xml-path extension, but I'm still interested in the standard jaxb solution for this problem.

+2
source

All Articles