相关疑难解决方法(0)

使用C#和HTMLAgility搜索网页

我已经读过HTMLAgility 1.4是一个很好的解压缩网页的解决方案.作为一名新程序员,我希望我能对这个项目有所了解.我这样做是作为ac#申请表.我正在使用的页面非常简单.我需要的信息只停留在2个标签之间.我的目标是将Part-Num,Manu-Number,Description,Manu-Country,Last Modified,Last Modified By的数据拉出页面并将数据发送到sql表.一个转折是还有一个小的png pic,也需要从src ="/ partcode/number中获取.

我没有任何已完成的代码.我以为这段代码会告诉我我是否正朝着正确的方向前进.即使进入调试我也看不到它做了什么.有人可能会指出我在这方面的正确方向.越详细越好,因为很明显我需要学习很多东西.谢谢,我真的很感激.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
using System.Xml;

namespace Stats
{
    class PartParser
    {
        static void Main(string[] args)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml("http://localhost");//my understanding this reads the entire page in?
            var tables = doc.DocumentNode.SelectNodes("//table");// I assume that this sets up the search for words containing table

        }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                Console.ReadKey();    
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

网络代码是:

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 …
Run Code Online (Sandbox Code Playgroud)

.net c# data-mining web-scraping html-agility-pack

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

.net ×1

c# ×1

data-mining ×1

html-agility-pack ×1

web-scraping ×1