Z
Zvi
Hi All,
Can someone tell me why id the following not working?
I have a soap response envelope, for test purpose it's just a string
and I create ElementTree from it.
Then I try to find Response tag, but I get None.
data = """<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/
soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body> <Get2Response xmlns="http://
tempuri.org/">
<Get2Result><![CDATA[<?xml version='1.0'
encoding='UTF-8'?> <Response> <Entity Name='Accounts'
Current='00300571B42F1DEC8E9B6CDF19A59950'> <Instance
Id='00300571B42F1DEC8E9B6CDF19A59950'> <Field
Name='Status' Value='2'/> <Field Name='Id' Value='MC4670'/> <Field
Name='Name' Value='ACDC Industries Inc'/>
<Field Name='City' Value='Milwaukee'/> <Field
Name='MainContact' Value=''/> <Field Name='CreatedOn'
Value='20070723051316.0000000 '/> </Instance> </Entity> </
Response>]]></Get2Result>
</Get2Response></soap:Body></soap:Envelope>"""
ElementTree.XMLTreeBuilder = SimpleXMLTreeBuilder.TreeBuilder
dom=ElementTree.fromstring(data)
if dom == None:
return "Empty Dom"
response = dom.find('{http://schemas.xmlsoap.org/soap/
envelope/}Response')
if response == None:
return "Empty Response"
if I try to use
response = dom.find('{http://tempuri.org/}Response') this doesn't work
either.
What am I doing wrong?
Can someone tell me why id the following not working?
I have a soap response envelope, for test purpose it's just a string
and I create ElementTree from it.
Then I try to find Response tag, but I get None.
data = """<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/
soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body> <Get2Response xmlns="http://
tempuri.org/">
<Get2Result><![CDATA[<?xml version='1.0'
encoding='UTF-8'?> <Response> <Entity Name='Accounts'
Current='00300571B42F1DEC8E9B6CDF19A59950'> <Instance
Id='00300571B42F1DEC8E9B6CDF19A59950'> <Field
Name='Status' Value='2'/> <Field Name='Id' Value='MC4670'/> <Field
Name='Name' Value='ACDC Industries Inc'/>
<Field Name='City' Value='Milwaukee'/> <Field
Name='MainContact' Value=''/> <Field Name='CreatedOn'
Value='20070723051316.0000000 '/> </Instance> </Entity> </
Response>]]></Get2Result>
</Get2Response></soap:Body></soap:Envelope>"""
ElementTree.XMLTreeBuilder = SimpleXMLTreeBuilder.TreeBuilder
dom=ElementTree.fromstring(data)
if dom == None:
return "Empty Dom"
response = dom.find('{http://schemas.xmlsoap.org/soap/
envelope/}Response')
if response == None:
return "Empty Response"
if I try to use
response = dom.find('{http://tempuri.org/}Response') this doesn't work
either.
What am I doing wrong?