Im using JDom for creating and retrieving XML messages. I would like to encode an object into xml, say I have a User object class this
class User
{
int id;
String name;
}
User user;
Is there a method that will automatically parse an object like this into an XML document or do I have to manually set the elements of the XML document?
XStream can do that for you. http://x-stream.github.io/
XStream is a simple library to serialize objects to XML and back again.