1
获取值我试图从XML获得输入反应值:C#从XML响应
<?xml version="1.0" encoding="utf-8"?>
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://adaddaasd.com">
<A>14</A>
<B>Failed</B>
<C>22</C>
</Response>
我的代码是:
string responseString = await response.Content.ReadAsStringAsync();
var xDocument = XDocument.Parse(responseString);
var responseNode = xDocument.XPathSelectElement("/Response");
var A = xDocument.XPathSelectElement("/Response/A");
但我得到了A和responseNode空值。怎么了?由于
尝试'var A = xDocument.XPathSelectElement(“/ A”);' –
没有工作,仍然变为空 –