| 208 | |
| 209 | def test1(): |
| 210 | class xmldict(dict): |
| 211 | def __xml__(self): |
| 212 | xml_elt = xml('dict') |
| 213 | for key in self: |
| 214 | xml_elt.append(xml('dictent',xml('key',str(key)), |
| 215 | xml('value',str(self[key])))) |
| 216 | return xml_elt |
| 217 | |
| 218 | e = xmldict() |
| 219 | e['foo'] = 'bar' |