Select an item next to the current HtmlAgilityPack

I am using HtmlAgilityPack to parse an html page. I want to select the h3 tag collection, then skip it, and for each h3 element, I want to select the element next to it. Here is my Html example:

<h3>Somthing here</h3>
<ul>list of something</ul>

<h3>Somthing here</h3>
<ul>list of something</ul>

<h3>Somthing here</h3>
<ul>list of something</ul>

<h3>Somthing here</h3>
<ul>list of something</ul>

<h3>Somthing here</h3>
<ul>list of something</ul>

I know how to choose the h3 collection, but I have no idea how to choose ul next to each

+1
source share
1 answer

If the current node is equal h3, use this XPath:

following-sibling::ul[1]

He chooses 1 stul sibling.

+2
source

Source: https://habr.com/ru/post/1676152/


All Articles