def endElement(self, name, value, connection):
    self._xml.write(('%s</%s>' % (cgi.escape(value).replace('&amp;amp;', '&amp;'), name)))
    if (len(self._nodepath) == 0):
        return
    obj = None
    curval = self.get(name)
    if (len(self._nodepath) == 1):
        if (value or (not curval)):
            self.set(name, value)
        if self._curobj:
            self._curobj = None
    elif self._curobj:
        self._curobj.endElement(name, value, connection)
    self._nodepath.pop()
    return None
def endElement(self, name, value, connection):
    self._xml.write(('%s</%s>' % (cgi.escape(value).replace('&amp;amp;', '&amp;'), name)))
    if (len(self._nodepath) == 0):
        return
    obj = None
    curval = self.get(name)
    if (len(self._nodepath) == 1):
        if (value or (not curval)):
            self.set(name, value)
        if self._curobj:
            self._curobj = None
    elif self._curobj:
        self._curobj.endElement(name, value, connection)
    self._nodepath.pop()
    return None