J'explore un site Web à l'aide de htmlagilitypack c #:
i have in the source code of an html page
....
<p>this a p that come before h3</p>
....
....
<h3>this h3 </h3>
<p>first p after h3</p>
....
<p>seconde p after h3</p>
je veux tous obtenir tous les ps qui viennent après
y a-t-il un moyen d'utiliser un endroit où filtrer Ps en utilisant la position.
où (position (p)> position (h3))
Essayez le code suivant:
var htmlText = "source code of your html page";
var htmlDoc.LoadHtml(htmlText);
var h3= htmlDoc.DocumentNode.SelectNodes("//h2");
var lineNum = h3[0].Line;
var p = htmlDoc.DocumentNode.SelectNodes("//p").Where(x => x.Line > lineNum);