using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace ParseXML
{
class Program
{
static void Main(string[] args)
{
string strXMl =@"<pre lang='xml'>"
+"<Root>"+
"<Something>"+
"<Word>Hello </Word>"
+"<Word>to </Word>"
+"<Word>the </Word>"
+"<Word>World </Word>"
+"</Something>"
+"<Something>"
+"<Word>John</Word>"
+"</Something>"
+"<Something>"+
"<Word>January </Word>"+
"<Word>February</Word>"
+"</Something>"+
"</Root>"+
"</pre>";
XDocument Xele = XDocument.Parse(strXMl);
foreach (var i in Xele.Descendants("Something"))
{
Console.WriteLine(i.Value);
}
}
}
}
You can use this approach