首页 > 其他 > 详细

读取.XML配置文件

时间:2014-04-17 04:11:39      阅读:430      评论:0      收藏:0      [点我收藏+]

///<summary>

///读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xml

///</sumary>

///<param name="p_key">XML节点名称</param>

///<returns>节点值</returns>

public static string GetConfigValue(string p_key)

{

XmlDocument doc = new XmlDocument();

string config = "";

string xmlPath = AppDomain.CurrentDomain.BaseDirectory+"GisServiceConfig.xml"; //获取"GisServiceConfig.xml"文件的路径

doc.Load(xmlPath);

if(!xmlPath)

{

XElement element = XElement.Parse(doc.InnerXml);

config = element.Element(p_key).Value;

return config;

}

else

{

return "":

}

}

读取.XML配置文件,布布扣,bubuko.com

读取.XML配置文件

原文:http://blog.csdn.net/zc707212993/article/details/23821263

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