Hello Marcin,<br><br>XmlStream is an implementation of XMPP/Jabber protocol (which is widely used for Instant Messaging). If you have time please read about this on <a href="http://www.xmpp.org">www.xmpp.org</a>. The reason why /frame handler was not executed is because XMPP/Jabber sessions starts and ends with streams like for example:<br>
<br><<em>stream</em>:<em>stream</em> xmlns:<em>stream</em>="<a href="http://etherx.jabber.org/streams">http://etherx.jabber.org/streams</a>"><br>.<br>.<br>.<br><message to='<a href="mailto:foo@jabber.org">foo@jabber.org</a>' from='<a href="mailto:bar@jabber.org">bar@jabber.org</a>><br>
<body>Hello World!</body><br></message><br>.<br>.<br>.<br></stream:stream><br><br>You might want to take a look at twisted XML-RPC libraries.<br><br>---<br>Alvin<br><br><br><div class="gmail_quote">
On Wed, Dec 17, 2008 at 7:25 PM, Marcin Gliński <span dir="ltr"><marcin@ascii-art.pl></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello!<br>
<br>
There's a problem I can't find an answer to. I'd like to design Xml<br>
based protocol.<br>
I've found XmlStream, read doc and found addObserver method. I wrote<br>
simple code:<br>
<br>
class XmlTest(xmlstream.XmlStream):<br>
# (...)<br>
def connectionMade(self):<br>
xmlstream.XmlStream.connectionMade(self)<br>
self.addObserver("/frame", self.frameHandler)<br>
# (...)<br>
<br>
# (...)<br>
<br>
def frameHandler(self, data):<br>
print "Wilma, I'm Home!"<br>
<br>
When I send XML with frame element as a root:<br>
<br>
<frame><br>
<whatever/><br>
</frame><br>
<br>
FrameHandler isn't executed, but if I put frame element inside some<br>
other root element:<br>
<br>
<sheep><br>
<frame><br>
<whatever/><br>
</frame><br>
</sheep><br>
<br>
Then my handler is activated. Why? First, I thought maybe my XPath<br>
knowledge is wrong,<br>
so I checked few tutorials[1] and they told me there's something wrong with<br>
addObserver method. How to make it working?<br>
<br>
<br>
<br>
~MG.<br>
(Hi, I'm new here :)<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.alvinatorsplayground.blogspot.com/">http://www.alvinatorsplayground.blogspot.com/</a><br>