Raphael.serialize
J u n
2 3
2 0 1 0
Last time I wrote a little about serializing SVG objects from RaphaelJS. I need to store them in a database and pull them back in. As usual I opted for a JSON string.
I've put the serialize code as a RaphaelJS plugin on github at jspies/raphael.serialize.
The upside is that the plugin runs through all the objects on save, whereas other techniques I've seen require monkey patching Raphael methods and storing references to the objects.
The downside is that each type of object is different and requires a special case.
Feel free to fork and add object cases.
One thing I would really like to do is separate the process from the output so that exporting into XML or YML or some custom JS object would be trivial.