----------------------------------------------------------------
In the above xml document how can i find the following result where -Type="SubMenu"
Text="Langrennsbindinger Skøyte" Value="1060402"
Text="Rulleskipigger" Value="1061304"
Text="Terrengsykkel Herre" Value="1010101"
--My Query Attempt--
XDocument xmlDoc_region = XDocument.Load(PathofXML);
var list_category = from nodeitem in xmlDoc_region.Elements("Navigation")
where nodeitem.Attribute("Type").Value == "MainMenu"
select new
{
CategoryName = nodeitem.Element("Node").Attribute("Text").Value,
CategoryId = nodeitem.Element("Node").Attribute("Value").Value
};
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Ruchir SaxenaPosted Sep 19, 2014, 6:30 AM
Arunava BhattacharjeePosted Sep 12, 2014, 7:53 AM
var query = (from n in xDoc.Descendants("Navigation")
where n.Attribute("Type").Value.Equals("SubMenu")
from view in c.Elements("Node")
select new
{ CategoryType = view.Attribute("Text").Value,
CategoryId = view.Attribute("Value").Value
}) .ToList();