Best practice for serializing / deserializing from Java to XML

What is the most suitable way to serialize Java classes for XML? I tried JAXB, but it has problems with interfaces and universals. Which solution is the least intrusive but scalable?

+7
java xml-serialization xml-deserialization
source share
2 answers

I have always had a positive experience with XStream:

http://x-stream.imtqy.com/tutorial.html#to-xml

As you can see, it is easy to use.

I have not actually used XStream with Generics (I used it only for simple classes like JavaBean), but Google seems to suggest that it handle them without problems. e.g. http://techo-ecco.com/blog/xstream-spring-ws-oxm-and-generics/

+4
source share

I would suggest solving problems with the interfaces and generics that you have with JAXB.

JAXB Marshalling and Generics

java.util.List is an interface, and JAXB cannot process interfaces

+1
source share

All Articles