Use SelectNodes to query nodes by XPath : XmlDocument : XML C# Source Code


Custom Search

C# Source Code » XML » XmlDocument »

 

Use SelectNodes to query nodes by XPath








    
 

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();
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo XML
» XmlDocument