Mega Code Archive

 
Categories / C# Tutorial / XML
 

XPath Select Nodes

using System; using System.Xml; public class MainClass {   [STAThread]   private static void Main()   {     XmlDocument doc = new XmlDocument();     doc.Load("Sample.xml");     XmlNodeList nodes = doc.SelectNodes("/Order/Items/Item/Name");              foreach (XmlNode node in nodes)     {       Console.WriteLine(node.InnerText);     }   } }