Dan Rosenstark Dan Rosenstark - 11 months ago 93
Java Question

Java: Serialize a Collection XML

Every time I've searched for something on how to serialize to XML, I found the bean serializers. It seems that everything has to be declared as a property, which defeats my purpose. I want to serialize complex hierarchies (until they get to primitives, of course) in XML, start with (say) a Dictionary or List as the parent object.

What options are there for automatic XML serialization?

I found some references to JAXB from 2004, is that still the way to go?

Answer Source

Try the XStream library. It will easily serialize any complex object hierarchy you can throw at it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download