Is there a (preferably free) Java analogue of .NET's XML serialization?
If you're talking about automatic XML serialization of objects, check out Castor:
Castor is an Open Source data binding framework for Java[tm]. It's the shortest path between Java objects, XML documents and relational tables. Castor provides Java-to-XML binding, Java-to-SQL persistence, and more.
XStream is pretty good at serializing object to XML without much configuration and money! (it's under BSD license).
We used it in one of our project to replace the plain old java-serialization and it worked almost out of the box.
The "Official" Java API for this is now JAXB - Java API for XML Binding. The reference implementation lives at https://jaxb.dev.java.net/
XMLBeans works great if you have a schema for your XML. It creates Java objects for the schema and creates easy to use parse methods.
Usually I use jaxb or XMLBeans if I need to create objects serializable to XML. Now, I can see that XStream might be very useful as it's nonintrusive and has really simple api. I'll play with it soon and probably use it. The only drawback I noticed is that I can't create object's id on my own for cross referencing.
@Barak Schiller
Thanks for posting link to XStream!