我正在向Salesforce merge API发出请求,得到如下响应:
xml_result = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com">
<soapenv:Header>
<LimitInfoHeader>
<limitInfo>
<current>62303</current>
<limit>2680000</limit><type>API REQUESTS</type></limitInfo>
</LimitInfoHeader>
</soapenv:Header>
<soapenv:Body>
<mergeResponse>
<result>
<errors>
<message>invalid record type</message>
<statusCode>INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY</statusCode>
</errors>
<id>003skdjf494244</id>
<success>false</success>
</result>
</mergeResponse>
</soapenv:Body>
</soapenv:Envelope>'
我希望能够解析这个响应,如果success=false,则返回错误、状态码和消息文本。在
我试过以下方法:
^{pr2}$…以及find
、findtext
和{
由于
mergeResponse
是子代,而不是子代,因此在这种情况下应该使用XPath语法:节点将返回。
.//
搜索从当前节点开始的所有子节点(在本例中是根节点)。在相关问题 更多 >
编程相关推荐