parser = xml.sax.make_parser(['xml.sax.IncrementalParser'])
handler = FooHandler()
parser.setContentHandler(handler)
data = sockfile.readline()
while len(data) != 0:
    parser.feed(data)
python handle endless XML