Not sure what exactly you are asking, but I would suggest you look at JAXB , one great Java standard for XML serialization.
Most serialization can be determined using annotations , but you can also provide your own serialization using what are called adapters..
Then you can execute marshall / unmarshall from / to XML as you wish. See this answer for an example.
source
share