[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

650 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