In the interests of completeness here are two alternatives to using
XDocument
to access your xml string
using System.Xml;
using System.IO;
...
var x = XmlReader.Create(new StringReader(xml));
while (x.Read())
Console.WriteLine(x.Value);
or
using System.Xml;
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
foreach (XmlElement x in xmlDoc.GetElementsByTagName("message"))
Console.WriteLine(x.InnerText);
The method you choose will depend upon how you want to search the document (back and forth, straight through, in blocks etc.) and obviously on what you have already done (which is why I asked in the comment).
There is a discussion on the 3 methods given in these Solutions (1 and 2)
here[
^]