| author | ymh <ymh.work@gmail.com> |
| Wed, 20 Jan 2010 00:34:04 +0100 | |
| changeset 0 | 0d40e90630ef |
| permissions | -rw-r--r-- |
| 0 | 1 |
""" |
2 |
Utilities for XML generation/parsing. |
|
3 |
""" |
|
4 |
||
5 |
from xml.sax.saxutils import XMLGenerator |
|
6 |
||
7 |
class SimplerXMLGenerator(XMLGenerator): |
|
8 |
def addQuickElement(self, name, contents=None, attrs=None): |
|
9 |
"Convenience method for adding an element with no children" |
|
10 |
if attrs is None: attrs = {} |
|
11 |
self.startElement(name, attrs) |
|
12 |
if contents is not None: |
|
13 |
self.characters(contents) |
|
14 |
self.endElement(name) |