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>&lt;<em>stream</em>:<em>stream</em> xmlns:<em>stream</em>=&quot;<a href="http://etherx.jabber.org/streams">http://etherx.jabber.org/streams</a>&quot;&gt;<br>.<br>.<br>.<br>&lt;message to=&#39;<a href="mailto:foo@jabber.org">foo@jabber.org</a>&#39; from=&#39;<a href="mailto:bar@jabber.org">bar@jabber.org</a>&gt;<br>
&nbsp;&nbsp; &lt;body&gt;Hello World!&lt;/body&gt;<br>&lt;/message&gt;<br>.<br>.<br>.<br>&lt;/stream:stream&gt;<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">&lt;marcin@ascii-art.pl&gt;</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&#39;s a problem I can&#39;t find an answer to. I&#39;d like to design Xml<br>
based protocol.<br>
I&#39;ve found XmlStream, read doc and found addObserver method. I wrote<br>
simple code:<br>
<br>
class XmlTest(xmlstream.XmlStream):<br>
 &nbsp; &nbsp;# (...)<br>
 &nbsp; &nbsp;def connectionMade(self):<br>
 &nbsp; &nbsp; &nbsp; &nbsp;xmlstream.XmlStream.connectionMade(self)<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self.addObserver(&quot;/frame&quot;, self.frameHandler)<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# (...)<br>
<br>
 &nbsp; &nbsp;# (...)<br>
<br>
 &nbsp; &nbsp;def frameHandler(self, data):<br>
 &nbsp; &nbsp; &nbsp; &nbsp;print &quot;Wilma, I&#39;m Home!&quot;<br>
<br>
When I send XML with frame element as a root:<br>
<br>
&lt;frame&gt;<br>
&nbsp;&lt;whatever/&gt;<br>
&lt;/frame&gt;<br>
<br>
FrameHandler isn&#39;t executed, but if I put frame element inside some<br>
other root element:<br>
<br>
&lt;sheep&gt;<br>
&nbsp;&lt;frame&gt;<br>
 &nbsp;&lt;whatever/&gt;<br>
&nbsp;&lt;/frame&gt;<br>
&lt;/sheep&gt;<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&#39;s something wrong with<br>
addObserver method. How to make it working?<br>
<br>
<br>
<br>
~MG.<br>
(Hi, I&#39;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>