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 Converting a Java Class to XML when Class contains Non-Primitive Types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Converting a Java Class to XML when Class contains Non-Primitive Types" Watch "Converting a Java Class to XML when Class contains Non-Primitive Types" New topic
Author

Converting a Java Class to XML when Class contains Non-Primitive Types

Michael Bradshaw
Greenhorn

Joined: Feb 11, 2011
Posts: 5

If I want to convert a class to XML, and that class contains a non primitive type, what do I do? In my case, I want to convert class Employee to XML, but it contains a non-primitive type (Department) that is another table. My simple example of this appears below.



The XML I want displayed is the following (I'm building a RESTful interface):



I'm using Spring, so it would be especially helpful if you could tell me how to do this using one of the marshallers they make available (JAXB, Castor, XMLBeans, JiBX, or XStream).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting a Java Class to XML when Class contains Non-Primitive Types
 
Similar Threads
what is the error in this program
problem with @FieldResult, mapping does not seem to work
Working with Interfaces
xml experts help me SAX Parser in xml
Marshalling XML with Spring (How to handle referenced classes)