【发布时间】:2013-11-08 23:05:32
【问题描述】:
我正在尝试使用 HtmlAgilityPack 来解析网页信息。这是我的代码:
using System;
using HtmlAgilityPack;
namespace htmparsing
{
class MainClass
{
public static void Main (string[] args)
{
string url = "https://bugs.eclipse.org";
HtmlWeb web = new HtmlWeb();
HtmlDocument doc = web.Load(url);
foreach(HtmlNode node in doc){
//do something here with "node"
}
}
}
}
但是当我尝试访问doc.DocumentElement.SelectNodes 时,我在列表中看不到DocumentElement。我在引用中添加了 HtmlAgilityPack.dll,但我不知道是什么问题。
【问题讨论】:
-
doc1.DocumentElement或doc1.DocumentNode? (顺便说一句,是doc还是doc1?) -
我不知道,现在它显示了 DocumentNode,但在一些教程中我找到了 DocumentElement。所以看来 DocumentNode 是正确的
-
but in some tutorial I found DocumentElement.例如? -
你能检查这个链接吗htmlagilitypack.codeplex.com/…
-
能介绍一下htmlagilitypack的教程吗?我是初学者
标签: c# html html-agility-pack