LINQ XML extract us ing VB.NET

Hello,

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

Thank you
<soap:Envelope>
<soap:Body>
 <ProcessMessageResponse>
 <payload>
 <content id="Content0">
 <OrderUpdateResponse>
 <Success>
  <Message>Order successfully updated.</Message> 
  </Success>
  </OrderUpdateResponse>
  </content>
  </payload>
  </ProcessMessageResponse>
 </soap:Body>
</soap:Envelope>

Open in new window

Tom SageAsked:
Who is Participating?
 
Sreedhar VengalaConnect With a Mentor Sr. Consultant - Business IntelligenceCommented:
XElement doc = XElement.Load("C:\\abc.xml");
IEnumerable<XElement> elements = from r in doc.Descendants("Message") select r;
0
 
Sreedhar VengalaSr. Consultant - Business IntelligenceCommented:
Try this:

from r in doc.Descendants("Message") select r;
0
 
Tom SageAuthor Commented:
That worked perfectly.  Thank you for your quick reponse.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.