You can add the outer element using @XMLElementWrapper annotation

http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlElementWrapper.html


On Tue, Jun 12, 2012 at 2:14 PM, Norman Maurer
<norman.mau...@googlemail.com> wrote:
> Hi there,
>
> I have a simple question ( at least I hope its simple) ;) I have the
> following pojo:
>
> @XmlRootElement(name="myclass")
> public class MyClass {
>     private Set<MySecondClass> mysecondclass = …
> ..
> }
>
> @XmlRootElement(name="mysecondclass")
> public class MySecondClass {
>     private String value = …
> ..
> }
>
> If I now send this back to the client I get an XML like this:
>
> <myclass>
>     <mysecondclass>
>         <value>blah</value>
>     </mysecondclass>
>     <mysecondclass>
>         <value>blah2</value>
>     </mysecondclass>
>     ….
> <myclass>
>
> Would it somehow possible to have it formatted like this:
>
> <myclass>
>     <mysecondclasses>
>         <mysecondclass>
>             <value>blah2</value>
>         </mysecondclass>
>         <mysecondclass>
>             <value>blah2</value>
>         </mysecondclass>
>         ….
>     </mysecondclasses>
> <myclass>
>
> This would be more inline with what I suspect and also "easier" to read. Any
> ideas ?
>
> --
> Norman Maurer
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>



-- 
jim stafford
SRA I&S | JHU

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to