上传者: zhengyuan168
|
上传时间: 2022-01-22 17:13:35
|
文件大小: 204KB
|
文件类型: -
C#解析html类库NSoup.dll
调用代码如下:
string html = "<html><head><title>First!</title></head><body><p title='test'>First post!</body></html>";
Document doc = NSoupClient.Parse(html);
NSoup.Select.Elements ele = doc.GetElementsByTag("title");
string title = "";
foreach (var i in ele)
{
title = i.ToString();
}
var Peles= doc.GetElementsByTag("p");
foreach (var item in Peles)
{
var t = item.Attr("title");
}