4
我有一個XML /香皂文件看起來像這樣:的LINQ to XML - 提取單元
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SendData xmlns="http://stuff.com/stuff">
<SendDataResult>True</SendDataResult>
</SendData>
</soap:Body>
</soap:Envelope>
我想提取的SendDataResult價值,但我有困難與下面的代碼等各種方式這樣做我試過了。即使元素中有一個值,它總是返回null。
XElement responseXml = XElement.Load(responseOutputFile);
string data = responseXml.Element("SendDataResult").Value;
需要做些什麼來提取SendDataResult元素。