How to Read a specific element value from XElement in LINQ to XML

If myXel already is the Response XElement then it would be:

var status = myXel.Elements().Where(e => e.Name.LocalName == "Status").Single().Value;

You need to use the LocalName to ignore namespaces.


XElement response = XElement.Load("file.xml"); // XElement.Parse(stringWithXmlGoesHere)
XNamespace df = response.Name.Namespace;
XElement status = response.Element(df + "Status");

should suffice to access the Status child element. If you want the value of that element as a string then do e.g.

string status = (string)response.Element(df + "Status");