{
string xmlStr =
@"
";
string xmlResponse = @"
01 XElement logicElem = XElement.Parse(xmlStr);
XElement responseElement = XElement.Parse(xmlResponse);
var responseCodePath = (from path in logicElem.XPathSelectElements("XMLParsing/NodesToRead/Path")
where path.Attribute("IsResponseCode") != null && bool.Parse(path.Attribute("IsResponseCode").Value)
select path.Value).FirstOrDefault();
string responseCode = (from v in responseElement.XPathSelectElements(responseCodePath)
select v.Value).FirstOrDefault();
string messagePath = (from path in logicElem.XPathSelectElements("XMLParsing/NodesToRead/Path")
where path.Attribute("IsMessage") != null && bool.Parse(path.Attribute("IsMessage").Value)
select path.Value).FirstOrDefault();
string responseMessage = (from v in responseElement.XPathSelectElements(messagePath)
select v.Value).FirstOrDefault();
var matchedResponseActions = from ra in logicElem.XPathSelectElements("ResponseActions/ResponseAction")
where ra.Element("ResponseCode").Value.Equals(responseCode)
|| ra.Element("ResponseCode").Value.Equals(responseCodePath)
select new
{
ResponseCode = ra.Element("ResponseCode").Value,
Action = ra.Element("Action").Value,
Message = ra.Element("Message") == null ? responseMessage : ra.Element("Message").Value
};
var ve = matchedResponseActions.ToList();
}