首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

读XML文件,该如何解决

2012-01-10 
读XML文件XML文件格式如下appSettingsadd keywebservice_url valuehttp://localhost:1885/Acmeway

读XML文件
XML文件格式如下
<appSettings>
  <add key="webservice_url" value="http://localhost:1885/Acmeway.Business.Webservices/Service.asmx" />
 <\appSettings>
怎么读出http://localhost:1885/Acmeway.Business.Webservices/Service.asmx信息

[解决办法]
XmlDocument doc = new XmlDocument();
doc.Load(file);
XmlNode node = doc.SelectSingleNode("/appSettings/add");

Console.WriteLine(node.Attributes["value"].Value);

热点排行