parsing different xml messages

kaklis at gmail.com kaklis at gmail.com
Tue Jul 27 06:17:36 EDT 2010


Hello,
I receive the following different Xml Messages from a socket:

<p_control_message serverIP="server-2" xmlns="http://test.com/pt">

  <cmdReply>

    <sessionList>

      <session>

        <id>5a62ded</id>

        <subscriberId>101</subscriberId>

        <subscriberName>Angie</subscriberName>

        <presence>online</presence>

        <note/>

        <ipAddress>Some IP</ipAddress>

        </session>

    </sessionList>

  </cmdReply>

</p_control_message>


<p_control_message xmlns="http://test.com/pt">

  <cmd>

    <systemMessage serverId="50" type="CRITICAL">

      <message>Server server-1 is going down for redeploy!</message>

    </systemMessage>

  </cmd>

</pttv_control_message>

Which is the best way to make a distinction between them so that every
time my app receives the one or the other, parse them correctly?

Thanks

Antonis K.



More information about the Python-list mailing list