[Twisted-Python] Help using XmlStreamFactory & XmlStream

Gabriel Rossetti mailing_lists at evotex.ch
Mon Feb 18 11:04:59 EST 2008


I am trying to write a Server and Client that use an XML protocol. I saw 
that there is a XmlStream class and tried to use it, but was unable to. 
I saw one small example for a client (http://ralphm.net/blog/2005/10), 
but it raises some questions.

First of all, it seams to work compleatly differently that the other 
server/client examples.

I don't understand why there is a need to add observers, and what they 
are used for. I can't get any of these to work (on either side, client 
or server):

    def connectionMade(self):
        print 'Connected!'

    def dataReceived(self, data):
        print data

    def onDocumentStart(self, rootElement):
        print "Message start : ", rootElement

    def onElement(self, element):
        print "current element : ", element

    def onDocumentEnd(self, rootElement):
        print "Message end : ", rootElement

I'm kind of lost :-(
I'm new to Twisted and I though that I understood how it works (read 
howtos, turorials, etc, but this one doesn't seam like the others. Can 
someone please point me to an example, I searched google but no luck. 
All I need is a simple client-server xml echo example or a better 
understanding of how it works and how it differs from the other echo 
examples. Thank you,


Thank you

More information about the Twisted-Python mailing list