Serializing objects derived from GObject to XML



Hi,

I'm looking for a way to serialize GObject-derived classes into XML. I'm
basically writing a block-diagram editor, similar to Simulink/Matlab,
where I have a Diagram class, and diff. block classes, and I'd like to
be able to save the diagrams to a file, so my idea is to implement a way
to serialize the blocks and the diagram. All interesting attributes are
implemented as GObject attributes, so if I can could implement
block_to_xml() and diagram_to_xml() functions, things would work out
nicely I think. Of course I would have to go the other way too, when
loading diagrams, xml_to_block() and xml_to_diagram().

The trouble is I don't really know where to start, is this something
that has been documented elsewhere, or does anyone know of some example
code or ideas I could look into?

My initial idea is to implement some sort of GObject serializer, which
outputs the classname, and the same for all properties the GObject has
registered.

Any comments would be most welcome!

--Jacob





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]