我有一个由
<title>Something</title>
<p>Text1</p1>
<p>Text2</p1>
<p>Text3</p1>
...
我想从中获取没有标题元素的文本。我只想提取:
Text1
Text2
Text3
你知道我怎么能做到吗?
现在我这样做:
var doc = new HtmlAgilityPack.HtmlDocument();
doc.Load(MyFile.html);
var stringWriter = new StringWriter();
AgilityPackEntities.AgilityPack.ConvertTo(doc.DocumentNode, stringWriter);
stringWriter.Flush();
document.DocumentContent = stringWriter.ToString();
return document;
*document 是方法参数。