dans div htmlagilitypack .net html-agility-pack parsing winforms
j'ai un div qui contient des balises de paragraphe comme ceci
<div class="div_5">
<p>First Paragraph</p>
<p>Second Paragraph</p>
<p>Third Paragraph</p>
<p>Fourth Paragraph</p>
</div>
<div class="div_5">
<p>First Paragraph</p>
<p>Second Paragraph</p>
<p>Third Paragraph</p>
<p>Fourth Paragraph</p>
</div>
j'ai besoin d'obtenir le texte de tous les textes de paragrap utilisant htmlagiitypack,
Dim oPB As HAP.HtmlNodeCollection = doc.DocumentNode.SelectNodes("//div[@class='post-bodycopy clearfix']/child::text()/"]
For Each item As HAP.HtmlNode In oPB
debug.print(item.InnerText)
Next
la sortie attend pour chaque chaîne div est
First Paragraph
Second Paragraph
Third Paragraph
Fourth Paragraph
mais je reçois du code HTML dans le texte renvoyé, quelqu'un peut-il m'aider à résoudre le problème
Vous devez réellement sélectionner le texte intérieur des paragraphes. Votre xpath obtient complètement autre chose.
Dim query = doc.DocumentNode.SelectNodes("//div[@class='div_5']/p/text()")