读书人

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

发布时间: 2012-04-30 22:33:26 作者: rapoo

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

读书人网 >C#

热点推荐