LINQ XML extract us ing VB.NET

Posted on 2009-04-06
Medium Priority
Last Modified: 2013-11-11

I would like to extract the element named "Message" from the XML shown below.

Thank you
 <content id="Content0">
  <Message>Order successfully updated.</Message> 

Open in new window

Question by:Tom Sage
  • 2

Expert Comment

by:Sreedhar Vengala
ID: 24082918
Try this:

from r in doc.Descendants("Message") select r;

Accepted Solution

Sreedhar Vengala earned 2000 total points
ID: 24082921
XElement doc = XElement.Load("C:\\abc.xml");
IEnumerable<XElement> elements = from r in doc.Descendants("Message") select r;

Author Closing Comment

by:Tom Sage
ID: 31567304
That worked perfectly.  Thank you for your quick reponse.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month16 days, 2 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question