首页 > 其他 > 详细

Xml读取

时间:2016-02-22 10:21:22      阅读:176      评论:0      收藏:0      [点我收藏+]
 
            var server = 4; try
            {
                XmlDocument xmlDoc = new XmlDocument();
                string xmlPath = AppDomain.CurrentDomain.BaseDirectory + "XML/ChannelConfig.xml";   //获取xml文件路径
                 
                xmlDoc.Load(xmlPath);
                var Key = ;

                string strNodePath = string.Format("/root/Channel[@Key=\"{0}\"]", Key);
                XmlNode xn = xmlDoc.SelectSingleNode(strNodePath);
                if (xn != null)
                {
                    server = Convert.ToInt32(xn.Attributes["server"].Value); 
                } 
            }
            catch (Exception ex)
            { 
            }

 

Xml读取

原文:http://www.cnblogs.com/dragon-L/p/5206188.html

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