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
    1. Advertising

  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.

    HTH


    "Patrick" <> wrote in message
    news:...
    > 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?
    analogueboy, Apr 14, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Siegl
    Replies:
    1
    Views:
    496
    Kermit T Tensmeyer
    Jul 28, 2003
  2. Replies:
    8
    Views:
    2,227
    deadsea
    Jan 2, 2005
  3. Replies:
    3
    Views:
    1,011
  4. Dimitri Ognibene
    Replies:
    4
    Views:
    767
    Dimitri Ognibene
    Sep 2, 2006
  5. Ramunas Urbonas
    Replies:
    1
    Views:
    382
    Dino Chiesa [Microsoft]
    Jul 27, 2004
Loading...

Share This Page