XmlDocument.SelectNodes : XmlDocument « System.Xml « C# / C Sharp by API






XmlDocument.SelectNodes

 

using System;
using System.Xml;

public class XPathSelectNodes {

    private static void Main() {

        // Load the document.
        XmlDocument doc = new XmlDocument();
        doc.Load("books.xml");

        XmlNodeList nodes = doc.SelectNodes("/books/A/B");
            
        foreach (XmlNode node in nodes) {
            Console.WriteLine(node.InnerText);
        }
    }
}

   
  








Related examples in the same category

1.new XmlDocument()
2.XmlDocument.AppendChild(XmlNode docNode)
3.XmlDocument.CreateComment(String comments)
4.XmlDocument.CreateElement
5.XmlDocument.CreateXmlDeclaration
6.XmlDocument.LoadXml(String xmlString)
7.XmlDocument.Save()
8.XmlDocument.SelectSingleNode