'Invokes the renderer and serializes the output for the web2py
template parser, returns a string to be written to the response
body, uses the xml() method of the renderer output, if present.'

def xml(self):

    output = self.render()
    if (output is None):
        return ''
    elif hasattr(output, 'xml'):
        return output.xml()
    else:
        return str(output)
