• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Xstream mapping for complex xml string to flatenned object.

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i just started playing with xstream.
i have an xml stream string which i have to convert to a flattened bean.
my xml message is




when extreme converts this into a bean it maps to an object graph. So my question object will have id, answerCount,url,publicationtime as properties defined.
Again i have a TopAnswer object which have its its meta data.

i wanted all this information to be transformed into a single flat object.
my proposed Question object will be flat and it will have properties like
id, answerCount,url,publicationtime,answerId,answerPublicationTime etc...
how do i provide this kind of complex xml message into a single flat bean.

Any help will be appreciated.

Thanks
darniz
 
Darvesh Niz
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok after reading more document i was able to flatten out the object.
Just wanted to make sure is this the correct way of doing it.

I still have the class structure defined and pass the xml.
I implemented a class which implements convertor interface and in the unmarhall method i am returning my own flattened objects.
This is what i am doing.


and in the QuestionsConvertor class in the unmarshal method i am returning a list of flattened QuestionItem objects.



Is there any other better way

please let me know

Thanks
darniz




 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic