I've been investigating this area recently, as I need some sort of data binding tool for my current project. I've looked at coding DOM manipulation, and would like to avoid it as too inefficient and not as easy as it could be. I've considered SAX, and am thinking of it as my fall-back position if nothing else works out, as (relatively) painful as it might be.
On top of that I've looked in David Mertz' xml_objectify, and while it looks like a great candidate for deserialization, I have noticed that I will be forced to code my own serializer. Again, not a problem in and of itself, but if someone else has already done the work and performed some real world testing, so much the better.
XML in and of itself is not bad as a serialization format, but the tools, so far, seem to be lacking. I would much rather have a serialization format that is easily read by humans, yet most tools seem to want to submerge the meaningful data in a morass of type declarations and placement/order information.
I'm currently looking into YAML (http://www.yaml.org) as an alternative, as the type information is embedded in the rather minimalist markup and structuring of the document. The resulting document is more easily understood by humans. The trade-off seems to be that the tools are not yet immature (Python's module seems to be in transition from the original developers to a new team), and of course, YAML is so unknown as yet that it is almost an anti-buzzword (PHB: "YAML, *what*?!?!?"), while XML is universally known and accepted at this point.
Uche, thank you for pointing out Skyron, as I will look into their offering. I would consider using generateDS.py, but I'd rather not have to create a schema for my serialization format if I can avoid it, and I'd *much* rather use RELAX NG than WXS, if I cannot (hint, hint, Mr. Kuhlman!!).
I've looked briefly at Skyron, and it doesn't really "fit my head". More specifically, I'd rather not have to learn some esoteric XML format for creating transformation recipes. In Python at least, it's just as easy to code it yourself.
YAML is not without its own set of problems, but they look eminently solvable. For the project on which I'm currently working, I need an all-Python solution. My target platform is Windows, and I haven't the luxury of Visual Studio or Cygwin. So, of my two candidates, Syck and PyYAML, I must choose PyYAML. And not unwillingly, since it seems ridiculously easy to use so far. I have run into a limitation, though, in its limited support for Python types. Specifically, PyYAML can handle most Python 2.1 or earlier built-in types, and handles classic classes quite well, but it cannot currently handle new-style classes by default. Thankfully, my current project does not require my serializable classes be new-style, so I am safe.
PyYAML does have a means of getting around this limitation, though I have not yet fully explored its usage. If your class defines a to_yaml() method, serializing calls this method instead of the underlying type-munging methods in yaml.Dumper(). to_yaml() should return a tuple consisting of the data you wish to serialize and a string defining the type of your class. Thus if your new-style class simply inherits from object, you can return (self.__dict__, " !!classname\n") and everything should be fine. N.B.: I have not thoroughly tested this solution, as I have not yet begun to deserialize these results, nor have I made sure that the output is valid YAML. Still, this solution provides a first step.