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」);' –
沒有工作,仍然變爲空 –