For the following string xml value, I need to fetch the value of node "ReturnStr"
<ArrayOfAppExportReturnStruct
xmlns=\"http://schemas.datacontract.org/2004/07/ClientWebService\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n
<AppExportReturnStruct>\r\n
<Key1>0</Key1>\r\n <Key2>0</Key2>\r\n
<PeriodDT>2019-02-26T00:00:00</PeriodDT>\r\n
<ReturnCode>1</ReturnCode>\r\n
<ReturnStr>Failure - No Deal found based on input parameters passed.</ReturnStr>\r\n
</AppExportReturnStruct>\r\n
</ArrayOfAppExportReturnStruct>
I used the following code
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString.Replace("\r\n",""));
string alarmDesc;
string xpath = "ArrayOfAppExportReturnStruct/AppExportReturnStruct";
var nodes = xmlDoc.SelectNodes(xpath);
foreach (XmlNode childrenNode in nodes)
{
alarmDesc = childrenNode.SelectSingleNode("ReturnStr").InnerText;
}
I am getting nothing in nodes var. What is the right way to get ReturnStr's node value in "alarmDesc".