'XML Parser callback. Used internally'

def endtag(self, tag):

    self.DEBUG(DBG_NODEBUILDER, ('DEPTH    ->    %i    ,    tag    ->    %s' % (self.__depth, tag)), 'up')
    self.check_data_buffer()
    if (self.__depth == self._dispatch_depth):
        if (self._mini_dom.getName() == 'error'):
            self.streamError = self._mini_dom.getChildren()[0].getName()
        self.dispatch(self._mini_dom)
    elif (self.__depth > self._dispatch_depth):
        self._ptr = self._ptr.parent
    else:
        self.DEBUG(DBG_NODEBUILDER, 'Got    higher    than    dispatch    level.    Stream    terminated?', 'stop')
    self._dec_depth()
    self.last_is_data = 0
    if (self.__depth == 0):
        self.stream_footer_received()
