I have this XML:
<?xml version="1.0" encoding="utf-8"?>
<envelope xmlns="myNamespace">
<response code="123" />
</envelope>
and I want to select the <response>
element like this:
XDocument doc = XDocument.Parse(myXmlString);
XElement response = doc.Root.Element("response");
but it returns null
. I know the element is there, because doc.Root.FirstNode
is the element I need.
What am I missing here?