orders.xml文档内容如下 Remarkable Office Supplies Electronic Protractor 42.99 Invisible Ink 200.25 //该代码片段来自于:www.sharejs.com/codes/csharp/7775 C#代码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(); }} //该代码片段来自于:www.sharejs.com/codes/csharp/7775
以上就是C#中通过xpath查找xml的指定元素的代码实例的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1429021.html
微信扫一扫
支付宝扫一扫