summaryrefslogtreecommitdiffstats
path: root/webapp/django/utils/xmlutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/django/utils/xmlutils.py')
-rw-r--r--webapp/django/utils/xmlutils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/webapp/django/utils/xmlutils.py b/webapp/django/utils/xmlutils.py
new file mode 100644
index 0000000000..a1eb5fb753
--- /dev/null
+++ b/webapp/django/utils/xmlutils.py
@@ -0,0 +1,14 @@
+"""
+Utilities for XML generation/parsing.
+"""
+
+from xml.sax.saxutils import XMLGenerator
+
+class SimplerXMLGenerator(XMLGenerator):
+ def addQuickElement(self, name, contents=None, attrs=None):
+ "Convenience method for adding an element with no children"
+ if attrs is None: attrs = {}
+ self.startElement(name, attrs)
+ if contents is not None:
+ self.characters(contents)
+ self.endElement(name)