--- saxutils.py.orig 2008-05-10 17:37:22.000000000 +0200 +++ saxutils.py 2008-05-10 18:04:39.000000000 +0200 @@ -83,7 +83,7 @@ class XMLGenerator(handler.ContentHandler): - def __init__(self, out=None, encoding="iso-8859-1"): + def __init__(self, out=None, encoding="iso-8859-1", empty_element_tag=False): if out is None: import sys out = sys.stdout @@ -93,6 +93,7 @@ self._current_context = self._ns_contexts[-1] self._undeclared_ns_maps = [] self._encoding = encoding + self._empty_element_tag = empty_element_tag self._pending_start_element = False def _write(self, text): @@ -137,7 +138,10 @@ self._write('<' + name) for (name, value) in attrs.items(): self._write(' %s=%s' % (name, quoteattr(value))) - self._pending_start_element = True + if self._empty_element_tag: + self._pending_start_element = True + else: + self._write(">") def endElement(self, name): if self._pending_start_element: