At the moment I know only some xml serializers with different capabilities to write an object to an xml file and retrieve it back from it:
- JDK classes (XmlEncoder and XmlDecoder)
- XStream (BSD license)
- The Simple project (Apache License 2.0) it even handles cycles.
- Apache Digester (Apache license) can only read xml. To write xml use Betwixt.
- X2JB (LGPL)
- XmlFormat from javolution.org (BSD license)
- cedarsoft serialization (GPL with classpath exception)
- Xerces XmlSerializer (Apache license) is this used as the implementation for the first one? I discovered the class com.sun.org.apache.xml.internal.serialize.XMLSerializer in the jdk …
- Burlap from Caucho (Apache license) used as serialization format over http.
- JAXB (Apache license)
- Smooks (LGPL)
- Moose (LGPL)
- Datanucleus (Apache license) JDO persistence into relational db, oo-db, xml, excel, …
- vtd-xml (GPL)
- WAX (LGPL) xml writer
- … more libraries (and an old benchmark)
- … or web services tools
Although xstream is very easy to use (like XmlEncoder) it is not that convenient to use if you want that you xml fits to a special schema (if you have cyclic references). For the latter case you can use JiBX, JAXB, Castor or whatever …
Please write a comment of your choice and include some information about the library and why you chose it.
- The Simple framework looks very promising!
- See this performance comparison (not only xml serializers! kryo looks simple and fast!)
BTW: If you want to unit test reading and writing xml then xmlunit will help you!