0
我从下面的http调用中获得响应。如何从python中的字符串获得完整的xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://xxx.abc.in"><SOAP-ENV:Body><ns1:LoginResponse><return><SessionID>abc12345</SessionID><ResponseCode>0</ResponseCode><ResponseMessage>Successful</ResponseMessage></return></ns1:LoginResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
现在既然这是字符串,我不能做一个XML差异。 当尝试使用ElementTree的将其转换成XML,我得到的只是根
tree = etree.fromstring(responseJson)
结果:
<Element '{http://schemas.xmlsoap.org/soap/envelope/}Envelope' at 0x3414c90>
请建议如何extact完整的XML(而无需将其保存为一个文件) 。我是新来个XML,所以甚至不知道我在做正确的操作