我需要从http://feeds.feedburner.com/Torrentfreak中提取xml文件的链接和描述。
我使用了以下代码:
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页面中使用了这个列表视图控件。
使用方法:
using
<%# Eval("LinkURL") %> - <%# Eval("Text") %>
但是它显示错误
值不能为 null。 参数名: source
问题出在哪里?使用 HtmlAgilityPack 是否可以抓取 xml 节点数据? 请给予建议 谢谢