XML serialization of default values

Discussion in 'Java' started by Patrick, Apr 13, 2004.

  1. Patrick

    Patrick Guest

    I've been trying to serialize Java objects to XML using both Java's
    serialization framework and Castor. I've found that in both cases,
    only the non-default values are written to XML. I need the default
    values to be serialized also, so that in case those values change in
    the future, I'll be able to read in what they were at the time.
    Additionally, the amount of data I'm serializing makes it impractical
    to write code to serialize each object individually, so I need
    something that uses reflection.

    How do people handle this? Is there a library which does this?
    Patrick, Apr 13, 2004
    1. Advertisements

  2. Patrick

    analogueboy Guest

    have a look at http://xstream.codehaus.org, I've used this a little and
    found that it is very easy to get set up and runs pretty quickly too.

    analogueboy, Apr 14, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.