Hi to all, and since this is my first post, congratulations for the perfect framework.<br>i have the following code<font class="fixed_width" face="Courier, Monospaced"><br><br>class SimpleServer(LineReceiver): <br> </font><p>
<font class="fixed_width" face="Courier, Monospaced"> def connectionMade(self): <br> print 'Connection from: ', self.transport.client <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced"> def connectionLost(self, reason): <br>
print self.transport.client, 'Disconnected' <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced"> def dataReceived(self, line): <br> """Here the XML Parser""" <br>
</font></p><p><font class="fixed_width" face="Courier, Monospaced"> p = xml.parsers.expat.ParserCreate() <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced"> p.StartElementHandler = start_element <br>
p.EndElementHandler = end_element <br> p.CharacterDataHandler = char_data <br> p.Parse(line, 1) <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">I got the following error <br>
--- <exception caught here> --- <br> File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux- <br> x86_64.egg/twisted/internet/selectreactor.py", line 146, in <br> _doReadOrWrite <br> why = getattr(selectable, method)() <br>
File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux- <br> x86_64.egg/twisted/internet/tcp.py", line 460, in doRead <br> return self.protocol.dataReceived(data) <br> File "stdiodemo.py", line 419, in dataReceived <br>
p.Parse(line, 1) <br> xml.parsers.expat.ExpatError: syntax error: line 1, column 0 <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">The XML Message is coming in the form of: <br> </font></p><p>
<font class="fixed_width" face="Courier, Monospaced">POST /test/pcp/Listener HTTP/1.1 <br> user-agent:hjahs <br> Host:127.0.0.1 <br> Content-Length: 547 <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced"><pttv_control_message version="1.0-M4-SNAPSHOT" build="599" <br>
xmlns="<a target="_blank" rel="nofollow" href="http://www.google.com/url?sa=D&q=http://1270.0.01/pttv&usg=AFQjCNEPqmRku5kV0nsb3RICWIxQ8vOV9A">http://1270.0.01/pttv</a>"> <br> <cmdReply> <br> <code>200</code> <br>
<message>OK, found 5 session entries</message> <br> <sessionList> <br> <session> <br> <id>06d4d59bfdfe10139dd874</id> <br> <subscriberId>82</subscriberId> <br>
<deviceClass>and</deviceClass> <br> </session> <br> </sessionList> <br> </cmdReply> <br> </pttv_control_message> <br> </font></p><font class="fixed_width" face="Courier, Monospaced">Please give me some hints.<br>
How to parse the incoming XML and how to ommit the headers from the beginning of the message?<br><br>Thanks in advance<br></font>