Omit the headers from XML message

K

kaklis

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>
 
J

Jon Clements

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))
 
S

Stefan Behnel

(e-mail address removed), 28.05.2010 17:24:
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>

Use the HTTP server that comes with Python, instead of the plain socket server.

Stefan
 
P

Peter Otten

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

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

Making the same assumptions, but giving a single string instead of a list of
lines:

s.partition("\n\n")[-1]

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,230
Latest member
LifeBoostCBD

Latest Threads

Top