[Soap-Python] How do I iterate through the results of a response when they contain prefixes?
Tim Callaghan
tmcallaghan at gmail.com
Wed Apr 29 23:01:15 CEST 2015
I have the following data and want to iterate over the "Discounts"? If I
didn't have the "a" prefix then the following code would work.
for disc in response.GetDiscountsResponse.GetDiscountsResult.Discount:
print " ", disc.Name, "[", disc.Id, "]"
-- response from server --
<s:Envelope xmlns:s="http://no-domain.com/soap/envelope/">
<s:Body>
<GetDiscountsResponse xmlns="http://no-domain.org/">
<GetDiscountsResult xmlns:a="
http://no-domain.com/2004/07/Pos.Web.Service.Data">
<a:Discount>
<a:Id>1</a:Id>
<a:Name>Discount 1</a:Name>
</a:Discount>
<a:Discount>
<a:Id>2</a:Id>
<a:Name>Discount 2</a:Name>
</a:Discount>
<a:Discount>
<a:Id>3</a:Id>
<a:Name>Discount 3</a:Name>
</a:Discount>
</GetDiscountsResult>
</GetDiscountsResponse>
</s:Body>
</s:Envelope>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20150429/3074ea4c/attachment.html>
More information about the Soap
mailing list