Reputation: 1672
I have a SOAP response which I am trying to parse with ElementTree
doc = ET.parse(response_xml)
for cust in doc.findall('.//{http://www.starstandards.org/webservices/2005/10/transport}Content'):
custnumber = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}CustomerNumber')
custfname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}FirstName')
custlname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}LastName')
return custnumber, custfname, custlname
I am trying to get the information out of the response and I keep getting the following error:
No such file or directory
Does the response_xml
need to be saved to a file before I can parse it? Why can't I just use it from memory?
Upvotes: 0
Views: 531
Reputation: 40773
ET.parse()
needs a file name. You might want to try ET.fromstring()
instead.
Upvotes: 1