I had originally had a "Foo" class in my REST server which was
serializing fine as "<foo>".  I then realized that this was really a
base class, so I added the subclasses of it, which are "Bar" and "Gork".
The declaration of the list of these is the following:

    @XmlElementWrapper(name = "childFoos")
    @XmlElement(name = "foo")
    private List<Foo>   childFoos;

When I serialize this, I get exactly what I specified here, such that
each "Foo" element is a "foo".

What I want is to have a "<childFoos>" list, but each element will
either be "<bar>" or "<gork>", depending on the subclass.  The data I
have in each "foo" is correct, reflecting whether it was a "bar" or a
"gork", but I want the wrapper to change based on that.

I tried to remove the "XmlElement" wrapper here, but that just resulted
in "<childFoos>" wrapping a list of "<childFoos>", not a mixture of
"<bar>" or "<gork>" elements.

Reply via email to