- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using HtmlAgilityPack;
- namespace agilitypack
- {
- class Program
- {
- static void Main(string[] args)
- {
- HtmlWeb webClient = new HtmlWeb();
- HtmlDocument doc = webClient.Load("http://msdn.microsoft.com/zh-tw/ee787055.aspx");
- HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("/html/body/div/div[2]/div/div/div[4]/div/div/h2[5]");
- foreach (HtmlNode node in nodes)
- {
- Console.WriteLine(node.InnerText.Trim());
- }
- doc = null;
- nodes = null;
- webClient = null;
- Console.WriteLine("Completed.");
- Console.ReadLine();
- }
- }
- }