XMLGenerator from xml.sax.saxutils is a steaming piece of crap. It is badly documented and it does not work. It does simple XML output just fine, but as soon as things become namespace aware I get Keyerrors which I cannot debug.
Example:
generator .startElementNS((ATOM_NAMESPACE, u'feed'), u'feed', AttributesNSImpl())Luckily I have stumbled upon JAXML which looks a lot friendlier to use.
