Use SelectNodes to query nodes by XPath

image_pdfimage_print
   
  

using System;
using System.Xml;

class MainClass {
    private static void Main() {
        XmlDocument doc = new XmlDocument();
        doc.Load("orders.xml");

        XmlNodeList nodes = doc.SelectNodes("/Order/Items/Item/Name");

        foreach (XmlNode node in nodes) {
            Console.WriteLine(node.InnerText);
        }
        Console.ReadLine();
    }
}

   
     


This entry was posted in XML-RPC. Bookmark the permalink.