This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Convert only selected Object elements to XML through Annotation? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Convert only selected Object elements to XML through Annotation?" Watch "Convert only selected Object elements to XML through Annotation?" New topic
Author

Convert only selected Object elements to XML through Annotation?

Chitra Jagannathan
Greenhorn

Joined: Apr 21, 2009
Posts: 8
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

Joined: Mar 22, 2000
Posts: 12756
    
    5
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

Joined: Nov 18, 2008
Posts: 433
    
    2
XStream can do this easily.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 499
    
    3
Check out the use of annotation @XmlTransient.
 
wood burning stoves
 
subject: Convert only selected Object elements to XML through Annotation?
 
Similar Threads
iterate through string get elements
converting xml tag elements
converting xml to xsl
<jsp:setProperty>
Question on polymorphic bean references.