Search code examples
javaxmljaxbxstreampojo

XStream or Simple


I need to decide on which one to use. My case is pretty simple. I need to convert a simple POJO/Bean to XML, and then back. Nothing special.

One thing I am looking for is it should include the parent properties as well. Best would be if it can work on super type, which can be just a marker interface.

If anyone can compare these two with cons and pros, and which thing is missing in which one. I know that XStream supports JSON too, thats a plus. But Simple looked simpler in a glance, if we set JSON aside. Whats the future of Simple in terms of development and community? XStream is quite popular I believe, even the word, "XStream", hit many threads on SO.

Thanks.


Solution

  • Why not use JAXB instead?

    • 100% schema coverage
    • Huge user base
    • Multiple implementations (in case you hit a bug in one)
    • Included in Java SE 6, compatible with JDK 1.5
    • Binding layer for JAX-WS (Web Services)
    • Binding layer for JAX-RS (Rest)
    • Compatible with JSON (when used with libraries such as Jettison)

    Useful resources: