从C#中的xml文件中获取节点的值 [英] getting value of a node from a xml file in C#

查看:679
本文介绍了从C#中的xml文件中获取节点的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

]
<开始>
<
PointList >

推荐答案

XmlDocument document = new XmlDocument();
        document.Load(filename);

        XmlTextWriter writer = new XmlTextWriter(Console.Out);
        writer.Formatting = Formatting.Indented;

        XmlNodeList nodes = document.SelectNodes("//Start/PointList/Points/EdgeList/EdgeId");


应该可以获得所有命名的节点。EdgeID的&NBSP;您可以在节点选择上使用任何XPath表达式。

that should get you all the nodes named EdgeId.  You can use any XPath expression on the node select.


这篇关于从C#中的xml文件中获取节点的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆