I have a XML Like Below, But i am not able to parse it. Please help me to parse the below XML.
What is blocking you?
You can try this:
var resultNewDataSet = XElement.Parse(xmlContent);
var result = resultNewDataSet.Descendants("Table")
.Select(t => new
{
aaa = t.Descendants("aaa").First().Value,
bbb = t.Descendants("bbb").First().Value
});
foreach (var res in result)
{
System.Diagnostics.Debug.WriteLine("aaa: " + res.aaa + " / bbb: " + res.bbb);
}
The element GetResult
is also in the http://tempuri.org
namespace, so that is why you select clause is not finding anything.
Anyhow, I would simplify the query to the following:
public static String myNamespace = "http://tempuri.org/";
XDocument reader = XDocument.Parse(response);
XElement resultElement = reader.Descendants(XName.Get("GetResult", myNamespace)).Single();