parts/django/django/utils/xmlutils.py
author Nishanth Amuluru <nishanth@fossee.in>
Sun, 09 Jan 2011 00:53:11 +0530
changeset 348 1eb24b1662cf
parent 307 c6bca38c1cbf
permissions -rw-r--r--
commenting does not need a verbose_name

"""
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)