File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 12787
    
    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: 513
    
    3
Check out the use of annotation @XmlTransient.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert only selected Object elements to XML through Annotation?