2005-07-13 09:25:57 +08:00
|
|
|
"""
|
|
|
|
Utilities for XML generation/parsing.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from xml.sax.saxutils import XMLGenerator
|
|
|
|
|
|
|
|
class SimplerXMLGenerator(XMLGenerator):
|
2006-06-03 21:37:34 +08:00
|
|
|
def addQuickElement(self, name, contents=None, attrs=None):
|
2005-07-13 09:25:57 +08:00
|
|
|
"Convenience method for adding an element with no children"
|
2006-06-03 21:37:34 +08:00
|
|
|
if attrs is None: attrs = {}
|
2005-07-13 09:25:57 +08:00
|
|
|
self.startElement(name, attrs)
|
|
|
|
if contents is not None:
|
|
|
|
self.characters(contents)
|
|
|
|
self.endElement(name)
|