Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAXB wrap wrapped collections

I have a class that contain two lists. I want to generate a wrapper element around the list elements, and around the two list.

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 generate a wrapper around the list with xml-element-wrapper but I can't wrap the two list into one element.

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

like image 643
Come get some Avatar asked Nov 04 '22 22:11

Come get some


1 Answers

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

like image 57
Come get some Avatar answered Nov 08 '22 07:11

Come get some