title: How can I traverse HTML DOM with Swift
body: <p>I have an http POST response which I receive in HTML. Now I want to display the results in my view Controller. How can I parse the DOM of the response to get the elements I want?</p>
  <p>This is the response in raw html:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;tr&gt;
    &lt;td style="text-align:center;"&gt;1&lt;/td&gt;
    &lt;td&gt;9.99&lt;/td&gt;
    &lt;td style="text-align:center;" class="show_on_masters hide"&gt;&lt;/td&gt;
    &lt;td style="text-align:center;"&gt;1.4&lt;/td&gt;
    &lt;td&gt;&lt;a href="https://athletics.ca/wp-content/themes/default-bs3/popups/athlete-rankings.php?id=9487257&amp;year=2021" class="fancybox" data-fancybox-type="iframe"&gt;DE GRASSE, ANDRE&lt;/a&gt;&lt;/td&gt;
    &lt;td style="text-align:center;"&gt;ON&lt;/td&gt;
    &lt;td&gt;
      &lt;div data-tooltip="Speed Academy Athletics Club"&gt;&lt;a href="http://www.speedacademy.ca" target="_blank"&gt;SAAC&lt;/a&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;94&lt;/td&gt;
    &lt;td&gt;&lt;a href="https://www.tfrrs.org/results/68975/UF_Tom_Jones_Invitational/" target="_blank"&gt;2&lt;/a&gt;&lt;/td&gt;
    &lt;!--&lt;td class="rankings_hide_992"&gt;UF Tom Jones Invitational (Olympic Development)&lt;/td&gt;--&gt;
    &lt;!--&lt;td class="rankings_hide_768"&gt;Gainesville , FL&lt;/td&gt;--&gt;
    &lt;td&gt;
      &lt;div data-tooltip="UF Tom Jones Invitational (Olympic Development)" style="cursor:default;"&gt;Gainesville , FL&lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;17/04/2021&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td style="text-align:center;"&gt;2&lt;/td&gt;
    &lt;td&gt;10.08&lt;/td&gt;
    &lt;td style="text-align:center;" class="show_on_masters hide"&gt;&lt;/td&gt;
    &lt;td style="text-align:center;"&gt;1.9&lt;/td&gt;
    &lt;td&gt;&lt;a href="https://athletics.ca/wp-content/themes/default-bs3/popups/athlete-rankings.php?id=9256053&amp;year=2021" class="fancybox" data-fancybox-type="iframe"&gt;BROWN, AARON&lt;/a&gt;&lt;/td&gt;
    &lt;td style="text-align:center;"&gt;ON&lt;/td&gt;
    &lt;td&gt;
      &lt;div data-tooltip="Phoenix Athletics Assoc. of Ontario"&gt;&lt;a href="http://phoenixathletics.ca" target="_blank"&gt;PHNX&lt;/a&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;92&lt;/td&gt;
    &lt;td&gt;&lt;a href="http://live.halfmiletiming.com/meets/294/events" target="_blank"&gt;7&lt;/a&gt;&lt;/td&gt;
    &lt;!--&lt;td class="rankings_hide_992"&gt;World Athletics - Miramar&lt;/td&gt;--&gt;
    &lt;!--&lt;td class="rankings_hide_768"&gt;Miramar, FL&lt;/td&gt;--&gt;
    &lt;td&gt;
      &lt;div data-tooltip="World Athletics - Miramar" style="cursor:default;"&gt;Miramar, FL&lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;10/04/2021&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td style="text-align:center;"&gt;3&lt;/td&gt;
    &lt;td&gt;10.14&lt;/td&gt;
    &lt;td style="text-align:center;" class="show_on_masters hide"&gt;&lt;/td&gt;
    &lt;td style="text-align:center;"&gt;0.7&lt;/td&gt;
    &lt;td&gt;&lt;a href="https://athletics.ca/wp-content/themes/default-bs3/popups/athlete-rankings.php?id=8989428&amp;year=2021" class="fancybox" data-fancybox-type="iframe"&gt;WARNER, DAMIAN&lt;/a&gt;&lt;/td&gt;
    &lt;td style="text-align:center;"&gt;ON&lt;/td&gt;
    &lt;td&gt;
      &lt;div data-tooltip="London Western T.F.C."&gt;&lt;a href="http://www.londonwesterntfc.com/" target="_blank"&gt;LWTF&lt;/a&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;89&lt;/td&gt;
    &lt;td&gt;&lt;a href="https://www.worldathletics.org/competition/calendar-results/results/7155327" target="_blank"&gt;1dec5&lt;/a&gt;&lt;/td&gt;
    &lt;!--&lt;td class="rankings_hide_992"&gt;Hypo-Meeting&lt;/td&gt;--&gt;
    &lt;!--&lt;td class="rankings_hide_768"&gt;Götzis, AUT&lt;/td&gt;--&gt;
    &lt;td&gt;
      &lt;div data-tooltip="Hypo-Meeting" style="cursor:default;"&gt;Götzis, AUT&lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;29/05/2021&lt;/td&gt;
  &lt;/tr&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I'm currently trying to use HTMLKit based on a couple tutorials, but I can't truly traverse the DOM with this library. Any ideas?</p>
  <blockquote>
  <p><a href="https://github.com/vapor-community/HTMLKit" rel="nofollow noreferrer">HTMLKit Tutorial</a></p>
  </blockquote>
  <p><a href="https://www.youtube.com/watch?v=biG7RnRR9Pg" rel="nofollow noreferrer">HTMLKit Video Tutorial</a></p>