在 C# 中如何读取 XML 文件中指定的某一个结点的值? xml 如下:<profile> <website> <site1> <server>nhii</server> </site1> </website></profile>如何用 c# 实现取得server的值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://cn.thespoke.net/MyBlog/xrascal/MyBlog.aspx protected XmlDocument _doc;_doc.LoadXml(xml文件的内容); //这里的内容是xml文档的字符串_doc.SelectSingleNode("website").SelectSingleNode("site1").SelectSingleNode("site1").InnerText; 如果一直文件路径请用doc.Load("文件的路径"); XmlNode x = doc.SelectSingleNode("/profile/website/site1/server");x.InnerText; 从youngfox处得到启发,此问题的关键在 NODE 的InnerText属性。正如 net_lover 所写! 请教:c#负载平衡 WinForm的ComboList 怎样将IDictionary, IEnumerable,这一类的数据用xml来存储和读取? 对.net技术版的版主提出的几点建议<jess_lv> 有关datagrid,应该说来满简单的一个问题,大家帮我看看 小妹请教:C#中如何把Tab键 关联到回车键的功能 新人提問 c# 奇怪了,在Console下数据库连接正常,WIN FORM下就出错,. c# 程序中,如何把文档打印到特定的打印机上? help ——————————————————————————————help me !!!!!!!!! 如何去掉一个文件名的后缀?
_doc.LoadXml(xml文件的内容); //这里的内容是xml文档的字符串
_doc.SelectSingleNode("website").SelectSingleNode("site1").SelectSingleNode("site1").InnerText;
请用doc.Load("文件的路径");
x.InnerText;