XML : Retrieve valid xml from socket

I'd like to read from a socket one byte at a time until a valid xml is returned. I can't seem to figure out the proper API provided by lxml as documentation isn't clear.

This is the scheleton of what I want.

  from lxml import etree   import SocketServer    class MyServer(SocketServer.BaseRequestHandler):    def handle(self):      data = self.request.recv(1)      for_,element in etree.iterparse(....)         # check for completion and create entree object when completed      

Is this the right way about this? Also can you guide me to etree APIs that make sense? I couldn't find if iterparse can take string objects

No comments:

Post a Comment