TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ruchir Saxena
NA
3.2k
3.3k
Linq to XML
Sep 12 2014 3:36 AM
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!--Creating an XML Tree for Navigation Menu-->
<NavigationDetails>
<Navigation Type="SubMenu">
<Node Text="Langrennsbindinger Skøyte" Value="1060402" />
<Node Text="Rulleskipigger" Value="1061304" />
<Node Text="Terrengsykkel Herre" Value="1010101" />
</Navigation>
<Navigation Type="MainMenu">
<Node Text="Komplette rulleski" Value="1061301" />
<Node Text="Rulleskihansker" Value="1061303" />
<Node Text="Sykkel" Value="1" />
</Navigation>
</NavigationDetails>
----------------------------------------------------------------
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
};
Reply
Answers (
2
)
how to modify the list which is obtained by linq
How to perform (insert ,update,delete,cancel) in gridview