IntelliJ Java IDE
The moose likes XML and Related Technologies and the fly likes Problem in using xstream annotations for complex java objects Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Problem in using xstream annotations for complex java objects" Watch "Problem in using xstream annotations for complex java objects" New topic
Author

Problem in using xstream annotations for complex java objects

Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 184
Hi,

I have a java object - Entity.java



I want to convert Entity.java to xml in the following format -



I have done something like this -


How do i annotate location and country?

Thanks.



Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 184
Deeps Mistry wrote:Hi,

I have a java object - Entity.java



I want to convert Entity.java to xml in the following format -



I have done something like this -


How do i annotate location and country?

Thanks.





Can anyone please help me out with this?

Thanks
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 225
How do i annotate location and country?

With the layout given, you practically no need to annotate location. For country, you simply alias the variable to country.

Most of the tag names will fall in place because you make the variable names conducive to the intended output.

Or do I miss something you have not shown (apart from those getters or setters or constructors...)?
 
 
subject: Problem in using xstream annotations for complex java objects
 
Threads others viewed
Append child + Xstream
@Responsebody for HTTP msg and a View to show the HTTP response msg
Architectural Suggestion Needed
update while doing save in hibernate
XStream + variable as an attribute to another variable which is tag.
developer file tools