'Called whenever data is received.
Passes the data to the XML parser. This can result in calls to the
DOM handlers. If a parse error occurs, the L{STREAM_ERROR_EVENT} event
is called to allow for cleanup actions, followed by dropping the
connection.'

def dataReceived(self, data):

    try:
        if self.rawDataInFn:
            self.rawDataInFn(data)
        self.stream.parse(data)
    except domish.ParserError:
        self.dispatch(failure.Failure(), STREAM_ERROR_EVENT)
        self.transport.loseConnection()
