Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I get this value using HtmlAgilityPack?
    text
    copied!<p>Not sure what that's called but it represents the user that created the forum thread:</p> <pre><code>... &lt;a href="http://myforum.com/forum/most-fav-action-movies/" id="thread_title_10178" style="font-weight:bold"&gt;Most Favorite Action Movies&lt;/a&gt; &lt;/div&gt; &lt;div class="smallfont"&gt; &lt;span style="cursor:pointer" onclick="window.open('http://myforum.com/forum/members/u506/', '_self')"&gt;JOANVENGE&lt;/span&gt; &lt;/div&gt; &lt;/td&gt; &lt;td class="alt2" title="Replies: 17, Views: 651"&gt; &lt;div class="smallfont" style="text-align:right; white-space:nowrap"&gt; ... </code></pre> <p>So in this case it's the "JOANVENGE" string I am trying to get. Currently I am getting the <code>a</code> links using this:</p> <pre><code>IEnumerable&lt;HtmlNode&gt; threadLinks = doc.DocumentNode. Descendants ( "a" ). Where ( link =&gt; link.Id.StartsWith ( linkIdPrefix ) ); </code></pre> <p>But that doesn't contain anything more than the forum url and id. That's why I am not sure how to get that text beyond the <code>a</code> link.</p> <p>EDIT: I am currently creating another <code>IEnumerable</code> that only collects "span" and then matches them to the first list, but this seems cumbersome and fragile, because for some reason <code>span</code> links are 1 more than <code>a</code> links so I am doing <code>index + 1</code>. Now it works fine but it would be more robust if I could access this information from the links of the first list directly. Next and Previous nodes until I hit <code>null</code> values also do not reach to <code>span</code> section. So I assume whatever the case may be, these are separate entities for HtmlAgilityPack.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload