def render(self, out, encoding="utf-8"): from xml.sax import saxutils handler = saxutils.XMLGenerator(out, encoding=encoding, short_empty_elements=True) self.publish(handler) handler.endDocument()