Robust XML Serialization

OK, I’ve had it with the serializers in .NET.
All of them are lacking atleast some features that I need.

XML serializer can not handle circular references.
Soap serializer can not handle generics.
Binary serializer is decent but will crash and burn if your class schema change (this applies to all the others to).

And then we have all those WCF thingies, but they require contracts/interfaces.

So I got tired of this mess and I’ve finally rolled my own XML serializer.

My serialzier supports:

  • Circular references
  • Generic lists
  • Error resolution
  • Clean XML format 

The error resolution works by raising events so that the developer can either ignore errors or resolve fields and types himself.

I have also added a default resolver that will handles missing “backing fields”

I’m using this serializer in Caramel Studio for the save file format.
So even if the model for my Caramel classes changes, you will still be able to load the files and you will only lose some settings.

The serializer is now part of my Alsing.Core project that can be found in the SVN repository at my google code site:
http://code.google.com/p/alsing

So what’s NOT supported then?

Currently lists will be treated in a special way, so only content of lists is serialized, any other custom state in a list will not be serialized.
I will add support for this later.

Multi dimentional arrays are not supported yet.

Work in progress:

I will make it possible to substitute types on serialization and deserialization, so that you can serialize graphs of proxy objects and then deserialize the same graph again by letting your proxy factory create the instances for you.

//Roger

Advertisement

5 Responses to Robust XML Serialization

  1. Blackhatseo says:

    Added. Nice work on this one. Btw, my blog is dofollow, stop by and grab a link. Bompa

  2. Great info – keep up the great work.

  3. Donald says:

    tar du aldrig ledigt :P

    sounds intresting im gonna try it.

  4. Phan Dung says:

    Love you man :x exactly what I am looking for. Built-in serializers sucks!

  5. Phan Dung says:

    By the way, you rock man! Thanks so much for the code!

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.