Get XML element value (with namespaces)

Hello, try to use “{ }” or if it’s dynamic which is like, “is dynamic :astonished:

<ab:xlvalue>Str</ab:xlvalue>
XNamespace ab = "http://your-url";
XElement tempElement = doc.Descendants(ab + "xlvalue").FirstOrDefault();

this way it will look for an xmlns:ab=… section in your document to find out which namespace URI “ab” refers to.

You can get it by finding the attribute value for XNamespace.Xmlns + “ab”

let us knwo if this is the answer you are looking for :slight_smile:

3 Likes