Read Xlement fully using LinQ
Posted
by Ramya
on Stack Overflow
See other posts from Stack Overflow
or by Ramya
Published on 2010-06-09T09:08:48Z
Indexed on
2010/06/09
9:12 UTC
Read the original article
Hit count: 216
LINQ
Hi, I have an XElement which I am getting after parsing an xml. This XElement needs to be read only when the need arises so, I have stored it in a list for future use. I have to read this XElement using LinQ.
XDocument doc = XDocument.Parse(DataManager.offeringElements[index].DataElem.ToString());
var docNode = from dataNode in doc.Descendants("DataLinks")
select new
{
Offering = dataNode .Element("link").Value,
linkUrl = dataNode.Element("link").Attribue
("href").Value };
the Xelement has the following nodes a. Management b. Analytics c. Development My problem is that I am not able to read all the three nodes.I am able to get only the first node. Where am I going wrong?
© Stack Overflow or respective owner