using System;
using System.Xml.Linq;
using System.Xml;
public class Program
{
public static void Main()
var xmlstr = @"<realRoot>
<node>
<desiredRoot>
<rootChild/>
<nestedChild/>
</desiredRoot>
</node>
</realRoot>";
var xd = XDocument.Parse(xmlstr);
var el = xd.Root.Element("node").Descendants();
foreach (var x in el)
Console.WriteLine("{0} [{1}]", x.Name, x.NodeType);
}