title: How do I use XPath in Nokogiri?
body: <p>I have not found any documentation nor tutorial for that. Does anything like that exist?</p>
  
  <hr>
  
  <pre><code>doc.xpath('//table/tbody[@id="threadbits_forum_251"]/tr')
  </code></pre>
  
  <p>The code above will get me any <code>table</code>, anywhere, that has a <code>tbody</code> child with the attribute <code>id</code> equal to "threadbits_forum_251". But why does it start with double <code>//</code>? Why there is <code>/tr</code> at the end? See "<a href="https://stackoverflow.com/questions/2062051/ruby-nokogiri-parsing-html-table-ii">Ruby Nokogiri Parsing HTML table II</a>" for more details.</p>
  
  <hr>
  
  <p>Can anybody tell me how to extract <code>href</code>, <code>id</code>, <code>alt</code>, <code>src</code>, etc., using Nokogiri? </p>
  
  <pre><code>td[3]/div[1]/a/text()' &lt;--- extracts text
  </code></pre>
  
  <p>How can I extract other things?</p>