我需要从中抓取 xml 文件http://feeds.feedburner.com/Torrentfreak http://feeds.feedburner.com/Torrentfreak其链接和描述。
我使用了这段代码:
var webGet = new HtmlWeb();
var document = webGet.Load("http://feeds.feedburner.com/TechCrunch");
var TechCrunch = from info in document.DocumentNode.SelectNodes("//channel")
from link in info.SelectNodes("//guid[@isPermaLink='false']")
from content in info.SelectNodes("//description")
select new
{
LinkURL = info.InnerText,
Content = content.InnerText,
};
lvLinks.DataSource = TechCrunch;
lvLinks.DataBind();
我已经在列表视图控件中使用它来显示在 ASP.NET 页面上。
使用
<%# Eval("LinkURL") %> - <%# Eval("Text") %>
但它显示错误
值不能为空。
参数名称:来源
有什么问题 ?是否可以使用 HtmlAgilityPack 抓取(获取)xml 节点数据?
请建议
谢谢
尝试使用 RSS 库而不是 HtmlAgilityPack:
以下是一些可能对您有帮助的链接:
- http://www.rssdotnet.com/ http://www.rssdotnet.com/
- http://www.yetanotherchris.me/home/2010/2/8/simplified-c-atom-and-rss-feed-parser.html http://www.yetanotherchris.me/home/2010/2/8/simplified-c-atom-and-rss-feed-parser.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)