Accepted answer

you can do this

xnamespace ns = xnamespace.get("xxxx");
var listofnames = doc.descendants(ns + "feed")
                     .select(x => x.elements().first().value).tolist();

+1 for lazyberezovsky's answer. if you need to specify the element name (name in this case) or you could have multiple name elements then you need to add a second namespace for those elements.

xnamespace ns2 = xnamespace.get("xxxxx");
var listofnames = doc.root.descendants(ns2 + "name").select(x => x.value).tolist();


to get rid of namespaces in xlinq queries, use similar method mentioned below:

string xml_string = @"<ns2:feeds xmlns:ns2=""xxxx"" xmlns=""xxxxx"" version=""3.0"">

var query = xelement.parse(xml_string).descendants()
           .where(c => == "name")

foreach (string item in query)


with xpathselectelements you should provide namespace manager in order to use namespaces in xpath query:

var manager = new xmlnamespacemanager(new nametable());
manager.addnamespace("ns2", "xxxx");
manager.addnamespace("ns", "xxxxx"); // default namespace

var names = from n in xdoc.xpathselectelements("//ns2:feed/ns:name", manager)
            select (string)n;

without xpath you should use xnamespace when providing name of node to find:

xnamespace ns = "xxxxx";
xnamespace ns2 = "xxxx";

var names = from f in xdoc.descendants(ns2 + "feed")
            select (string)f.element(ns + "name");

Related Query

More Query from same tag