Hello all, In my project, I have container classes holding lists of item classes. For example, a container class myLibrary might hold a list of item classes myNation and associated variables like myNation.name='USA' and myNation.continent='North America'.
Bottom line, I was hoping to use this structure to marshal the classes to xml. However, I've got dozens of unique classes (all subclassing the container and item classes) with unique variables attached, and I do not want to write rules for each. I was looking at the source for generic in xml.marshal (from xml.marshal import generic) which will dump to xml any configuration of standard Python data types, for example, a tuple of dictionaries containing lists of strings. This source just writes a rule for each data type. Naively, I would hope that there'd be something where the marshaller could just look at my data class, see what variables were associated, and just go from there. I'm moderately experienced with Python, but by no means an expert, and I'm not an xml pro, either. Would this project (xml marshal of a new class) be worth my time? If so, what would be best way to proceed? Any other thoughts? >>> import xml.marshal >>> from xml.marshal import generic >>> generic.dumps(['thank you','comp.lang.python']) '<?xml version="1.0"?><marshal><list id="i2"><string>thank you</string><string>comp.lang.python</string></list></marshal> -- http://mail.python.org/mailman/listinfo/python-list