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

C#如何读取Xml文件的节点值

2012-04-30 
C#怎么读取Xml文件的节点值?xml version1.0 encodingGBK?-smartresult-product typeipip

C#怎么读取Xml文件的节点值
<?xml version="1.0" encoding="GBK"?>
-<smartresult> 
  -<product type="ip"> 
  <ip>49.76.255.175</ip> 
  <location>美国 亚利桑那州JITCNET</location> 
  </product> 
</smartresult>

我请求某个服务器返回的xml数据,
我想把<ip></ip>和<location></locaton>里的值取出来显示在界面上。怎么做。

[解决办法]
参考http://topic.csdn.net/u/20120421/20/7c878b85-9f8f-4bfb-b66a-232d9db421b7.html
[解决办法]
doc.SelectSingleNode("/smartresult/product/ip").InnerText
doc.SelectSingleNode("/smartresult/product/location").InnerText

热点排行