• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Marshalling an ArrayList of JAXB bound Objects

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone!

I'm a JAXB newbie, trying to implement a REST web service with Glassfish (using NetBeans as IDE). I need to send an XML fle as response of the service, so I'm trying to use JAXB, which seems to be much better than DOM and JAX.

I've bound a class named MyAlbum to JAXB with annotations, and I need to marshal an ArrayList of MyAlbum. I thought it would have been enough to simply pass the ArrayList to the marshaller, as JAXB supports many containers out of the box, but I get a blank XML :/

I tried to pass to the Marshaller myArrayListofMyAlbums.toArray(), and still nothing...

Any ideas?
 
Daniela De Santis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, this is not exactly the welcome one would expect... anyway, I solved implementing a container class and binding it to JAXB.
 
Marshal
Posts: 28237
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Daniela De Santis:
well, this is not exactly the welcome one would expect...

If it makes you feel any better, I have noticed that questions about JAXB on other Java programming forums usually don't get answers either.
reply
    Bookmark Topic Watch Topic
  • New Topic