从xml获取字段?

时间:2017-06-29 14:49:58

标签: python xml xpath elementtree

我有一个xml如下:

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Header>
<h:Challenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
<Status>Unauthenticated</Status>
<Nonce>359DCCAB1A8AC6E2</Nonce>
<Realm>F!Box SOAP-Auth</Realm>
</h:Challenge>
</s:Header>
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:dslforum-org:control-1-0">
<errorCode>503</errorCode>
<errorDescription>auth. failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

使用et.find(&#39; .// Nonce&#39;)获取Nonce和Realm值没有问题,例如

但我无法得到&#34; errorCode&#34;与et.find(&#39; .// errorCode&#39;)。

我在这里想念什么?

迈克尔

0 个答案:

没有答案