【发布时间】:2011-07-19 18:53:20
【问题描述】:
我有一个如下所示的 XML/Soap 文件:
<?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 元素需要做什么。
【问题讨论】: