- using System;
- using System.Xml;
- public class XPathSelectNodes {
- private static void Main() {
- // Load the document.
- 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();
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/040920135621.html
来源: http://www.codesnippet.cn/detail/040920135621.html