Bonjour,
I have an xml doc:
<ns2:feeds xmlns:ns2="XXXX" xmlns="XXXXX" version="3.0">
<ns2:feed>
<name>XXX</name>
</ns2:feed>
<ns2:feed>
<name>XXX</name>
</ns2:feed>
<ns2:feed>
<name>XXX</name>
</ns2:feed>
</ns2:feeds>
How can I use LinqToXml to get a list of Name properties? nothing I try seems to work...
var doc = XDocument.Load(@"feed.xml");
var names = doc
.XPathSelectElements("/*/*[localname()='feeds']") //What should the Xpath be, here?
.Select(p => new
{
Name = p.Descendants("name").First().Value
})
.ToList();
Is there a simple way to achieve this?
XNamespace ns = "XXXXX";and thenp.Descendants(ns + "name").First().Value.