Solved with:
Code:Dim arqHtml As String = "C:\Users\Mattia\Desktop\ready.html" Dim myHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument() myHtml.Load(arqHtml) Dim myTable As HtmlAgilityPack.HtmlNode = myHtml.DocumentNode.SelectSingleNode("//table") Dim myRows As HtmlAgilityPack.HtmlNodeCollection = myTable.SelectNodes("tr") For Each tmpRow As HtmlAgilityPack.HtmlNode In myRows Dim myCells As HtmlAgilityPack.HtmlNodeCollection = tmpRow.SelectNodes("td") If myCells IsNot Nothing Then Dim myToken As String = myCells(0).InnerText Dim mySpans As HtmlAgilityPack.HtmlNodeCollection = myCells(1).SelectNodes("div[contains(@class,'select-list')]/span") Dim chainText As String If mySpans Is Nothing Then Dim chainTextNode As HtmlAgilityPack.HtmlNode = myCells(1).SelectSingleNode( "div[contains(@class, 'chain_box')]/span[contains(@class, 'chain_name')]" ) chainText = If(chainTextNode Is Nothing OrElse String.IsNullOrWhiteSpace(chainTextNode.InnerText), "(unknown)", chainTextNode.InnerText) Else chainText = String.Join(", ", mySpans.Select(Function(span) span.InnerText)) ' Alternative: chainText = String.Join(", ", From span In mySpans Select span.InnerText) End If RichTextBox1.Text &= $"{myToken} - {chainText}{Environment.NewLine}" End If Next




Reply With Quote
