文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>如何获取xml任意节点中某个属性值

如何获取xml任意节点中某个属性值

时间:2011-06-01  来源:笨笨的菜鸟

 View Code
 1 public string GetXmlNodeValue(string strXml,string strNodeName,string strValueName)
2 {powered by 25175.net
3 try
4 {
5 System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
6 xmlDoc.LoadXml(strXml);
7 System.Xml.XmlNode xNode = xmlDoc.SelectSingleNode("//" + strNodeName + "");
8 string strValue = xNode.Attributes[strValueName].Value;
9 return strValue;
10 }
11 catch (Exception ex)
12 {
13 return ex.Message;
14 }
15
16 }
排行榜 更多 +
goliathio

goliathio

休闲益智 下载
妙花笔记

妙花笔记

游戏工具 下载
精准卫星地图

精准卫星地图

游戏工具 下载