• 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

binding to List

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an xml like this :

<Zoo>
<Lion>
<Zebra>
....
</Zoo>

----------------------------------
And on my java project , i have an abstract class "Animal" and all the animals (like lion , zebra ) extends from it.

How can i unmarshal my xml to my class "Zoo" that contains a "List<Animal> animalList".



I hope, i explained my scenario clearly. Can someone please help me. So far i am unable to successfully unmarshal my xml file to List of Animals. Please help

-Owais
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you saying "unmarshal"?

We usually speak of parsing XML so it sounds like there are some additional requirements you are not describing.

Bill
 
Owais Zahid
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill , i am using JAXB that is why i used the terminology of "un-marshalling".

If you can help me that what sort of Annotations (XML ELEMENT or INTERCEPTOR ) i need to write in order to map all the tags (like lion , zebra blah blah) to my list of animals.



 
reply
    Bookmark Topic Watch Topic
  • New Topic