http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 3028|回复: 3

[其他] C#读取xml文档

[复制链接]
发表于 2013-6-13 10:40:40 | 显示全部楼层 |阅读模式
<?xml version="1.0"?>
<?xml-stylesheet href="file:///F:/nmap/nmap.xsl" type="text/xsl"?>
<!-- Nmap 6.25 scan initiated Mon May 27 13:39:09 2013 as: nmap -oX D:\\as.xml 10.10.133.120 -->
<nmaprun scanner="nmap" args="nmap -oX D:\\as.xml 10.10.133.120" start="1369633149" startstr="Mon May 27 13:39:09 2013" version="6.25" xmloutputversion="1.04">
<scaninfo type="syn" protocol="tcp" numservices="1000" services="1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416"/>
<verbose level="0"/>
<debugging level="0"/>
<host starttime="1369633149" endtime="1369633151"><status state="up" reason="echo-reply" reason_ttl="63"/>
<address addr="10.10.133.120" addrtype="ipv4"/>
<hostnames>
</hostnames>
<ports><extraports state="closed" count="986">
<extrareasons reason="resets" count="986"/>
</extraports>
<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="http" method="table" conf="3"/></port>
<port protocol="tcp" portid="135"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="msrpc" method="table" conf="3"/></port>
<port protocol="tcp" portid="139"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="netbios-ssn" method="table" conf="3"/></port>
<port protocol="tcp" portid="445"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="microsoft-ds" method="table" conf="3"/></port>
<port protocol="tcp" portid="1025"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="NFS-or-IIS" method="table" conf="3"/></port>
<port protocol="tcp" portid="1026"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="LSA-or-nterm" method="table" conf="3"/></port>
<port protocol="tcp" portid="1027"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="IIS" method="table" conf="3"/></port>
<port protocol="tcp" portid="1028"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="unknown" method="table" conf="3"/></port>
<port protocol="tcp" portid="1029"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="ms-lsa" method="table" conf="3"/></port>
<port protocol="tcp" portid="1030"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="iad1" method="table" conf="3"/></port>
<port protocol="tcp" portid="1433"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="ms-sql-s" method="table" conf="3"/></port>
<port protocol="tcp" portid="1720"><state state="filtered" reason="no-response" reason_ttl="0"/><service name="H.323/Q.931" method="table" conf="3"/></port>
<port protocol="tcp" portid="3306"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="mysql" method="table" conf="3"/></port>
<port protocol="tcp" portid="6001"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="X11:1" method="table" conf="3"/></port>
</ports>
<times srtt="5709" rttvar="3304" to="100000"/>
</host>
<runstats><finished time="1369633151" timestr="Mon May 27 13:39:11 2013" elapsed="1.80" summary="Nmap done at Mon May 27 13:39:11 2013; 1 IP address (1 host up) scanned in 1.80 seconds" exit="success"/><hosts up="1" down="0" total="1"/>
</runstats>
</nmaprun>
求救,想用C#读取上面xml文档内容中port中的内容,恳求大神能给出代码。谢谢


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2013-6-13 10:50:07 | 显示全部楼层
http://www.sufeinet.com/thread-3586-1-2.html看看这个问题你们的基本上相同的
 楼主| 发表于 2013-6-13 11:10:16 | 显示全部楼层
yangying 发表于 2013-6-13 10:50
http://www.sufeinet.com/thread-3586-1-2.html看看这个问题你们的基本上相同的

大神,我看过了,不一样啊。对于xml真不懂,大神请问我 这个能读取出来么?
发表于 2013-6-13 11:14:07 | 显示全部楼层
dcx 发表于 2013-6-13 11:10
大神,我看过了,不一样啊。对于xml真不懂,大神请问我 这个能读取出来么?

这两个是一样的,只是取的属性不一样。
你没认真看文章吧。
不懂就学习一下,如果直接给我代码,你不懂又怎么添加到程序里面呢?主要是看看Xpath就行了。

//Goods[@id='1000']/Info这个修改成 foreach (XmlNode item in doc.SelectNodes("//port"))
            {
                //取Value
                string value = item.InnerText;
            
            }
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-5-18 06:06

© 2014-2021

快速回复 返回顶部 返回列表