首页 > 其他 > 详细

linq 读取xml

时间:2015-01-14 14:00:05      阅读:244      评论:0      收藏:0      [点我收藏+]

xml 文件如下:

<?xml version="1.0" encoding="utf-8" ?>
<nodes>
<node>
<项目类型>农用地转用</项目类型>
</node>
</nodes>

 

相关的代码如下:

string xmlPath = Application.StartupPath + @"\config.xml";
XDocument xd = XDocument.Load(xmlPath);
string xmlx = "";
foreach (XElement item in xd.Root.Descendants("node"))//得到每一个node节点,得到这个节点再取他的xmlx的这个节点
{
xmlx=item.Element("项目类型").Value;
}

  

 

linq 读取xml

原文:http://www.cnblogs.com/huchaoheng/p/4223640.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!