This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert only selected Object elements to XML through Annotation?

 
Chitra Jagannathan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we Convert only selected Object elements to XML through Annotation?

Ex:
Person
- name
- empId
- address
- city
- profession

I want to convert Person object to XML through annotation with only empId and profession.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, if I want a custom serialization of an object I just build a string in the correct XML format with the desired values.

 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XStream can do this easily.
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the use of annotation @XmlTransient.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic