I don&#39;t think that the method onDocumentEnd will be triggered on that error. I assume that the received xml is invalid and the code that is disconnecting the client is on the overridden dataReceived method of xmlstream.py:<br>
<br>&nbsp;def dataReceived(self, data):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;&quot;&quot; Called whenever data is received.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Passes the data to the XML parser. This can result in calls to the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DOM handlers. If a parse error occurs, the L{STREAM_ERROR_EVENT} event<br>
&nbsp;&nbsp;&nbsp; is called to allow for cleanup actions, followed by dropping the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connection.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;&quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if self.rawDataInFn: self.rawDataInFn(data)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.stream.parse(data)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except domish.ParserError:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.dispatch(self, STREAM_ERROR_EVENT)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>### Put some code here that will write the received invalid xml data to a file</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.transport.loseConnection() --&gt; <b>Your clients get disconnected here when sending an invalid xml</b><br>
<br>Since it&#39;s a pyExpat/domish error your client gets disconnected by the transport.loseConnection() call. I suggest that you put something under except to check if your xmpp client is sending an invalid xml.<br><br>
Cheers,<br>Alvin<br><br><br><div class="gmail_quote">On Tue, May 20, 2008 at 11:50 PM, Gabriel Rossetti &lt;mailing_lists@evotex.ch&gt; 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>
I am using xmlstream.XmlStream to process...XML streams :-)<br>
I&#39;m having a bit of a problem, I have a client and a server, both protocols inherit from xmlstream.XmlStream. When the client sends 4 messages, one after another, I get a parse error. I debugged my program, and the buffer the expat parser is given contains in effect, 4 messages consecutively like so :<br>

<br>
str: &lt;message&gt;...&lt;/message&gt;&lt;message&gt;...&lt;/message&gt;&lt;message&gt;...&lt;/message&gt;&lt;message&gt;...&lt;/message&gt;<br>
<br>
(I replaced the child elements with &quot;...&quot; for your reading enjoyment)<br>
<br>
and I get this Exception when debugging (otherwise it stays hidden) :<br>
<br>
ExpatError: junk after document element: line 1, column 196<br>
<br>
now column 196 is the end of the 1st msg&#39;s root element, I think it doesn&#39;t like the next message being right after the first. I did override xmlstream.XmlStream.onDocumentEnd()<br>
because I didn&#39;t want it to close the connection in between messages, but in my method I told it to initialize the stream using :<br>
<br>
self._initializeStream()<br>
<br>
I did this since I noticed that closing the connection forces a new parser to be created when the previous statement is called. The reason I don&#39;t want the connection to be closed is that I&#39;d like a persistent connection to be held.<br>

<br>
Does anyone know how to either have the messages given to the parser as separate messages so that it doesn&#39;t freak out?<br>
<br>
Thank you,<br>
Gabriel<br>
<br>
<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">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>