Omit the headers from XML message

Jon Clements joncle at googlemail.com
Fri May 28 11:45:41 EDT 2010


On 28 May, 16:24, "kak... at gmail.com" <kak... at gmail.com> wrote:
> Hi i have the following xml message i want to omit the headers, any
> hints?
>
> POST /test/pcp/Listener HTTP/1.1
> User-Agent: Jakarta Commons-HttpClient/3.1
> Host: 127.0.0.1:50002
> Content-Length: 547
>
> <pt_control_message xmlns="http://demo.com/demo">
>   <cmdReply>
>     <sessionList>
>       <session>
>         <id>scvdcvsdv</id>
>         <subscriberId>sdfv</subscriberId>
>         <subscriberName>Antonis Kaklis</subscriberName>
>         <presence>away</presence>
>         <note>testing the new client</note>
>         <ipAddress>jlkdjf</ipAddress>
>         <deviceClass>android</deviceClass>
>       </session>
>     </sessionList>
>   </cmdReply>
> </pt_control_message>

Assuming the header is separated by a blank line, something like:

list(islice(dropwhile(bool, s.split('\n')), 1, None))



More information about the Python-list mailing list