[Tutor] parsing response from SOAPpy request

Alan Gauld alan.gauld at btinternet.com
Sat Sep 1 18:09:21 CEST 2007


"Sean Cronin" <seancron at gmail.com> wrote

> The response comes back as XML document but when I check it with
> type(result) it shows the the response is a string.

Thats right the string is the XML document, just as if you had read it
from a file with the read() method.

> Does anyone have any suggestions on getting relevant data?

You need to parse the xml.

The classic way to do that is using DOM or sax parsing, but
Python now has the ElementTree parser which is usually
much easier to use. Look at the module docs and for a lot
more detail visit the ElementTree homepage:

http://effbot.org/zone/element-index.htm

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list