Net20, Net40 등과 같은 여러 폴더를 찾은 HtmlAgilityPack의 최신 버전을 다운로드했습니다. 참조를 추가하여 HtmlAgilityPack을 추가했습니다 (Net20 폴더에서 .dll을 선택했습니다). 그런 다음 간단한 코드를 작성했습니다. using HtmlAgilityPack;
추가 한 위치 using HtmlAgilityPack;
. 그래서 이제 기호를 using 선언문에서 사용할 수 없다는 오류가 발생했습니다.
뭐가 문제 야? 나는 내가 도서관에 문제가 있다고 생각한다.
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
int main()
{
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
// There are various options, set as needed
htmlDoc.OptionFixNestedTags=true;
// filePath is a path to a file containing the html
htmlDoc.Load(filePath);
// Use: htmlDoc.LoadXML(xmlString); to load from a string
// ParseErrors is an ArrayList containing any errors from the Load statement
if (htmlDoc.ParseErrors!=null && htmlDoc.ParseErrors.Count>0)
{
// Handle any parse errors as required
}
else
{
if (htmlDoc.DocumentNode != null)
{
HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body");
if (bodyNode != null)
{
// Do something with bodyNode
}
}
}
}