title: Parse HTML table to Groovy list?
body: <p>I'd like to parse an HTML page and get the table values. For example parsing through it to get a list of dictionaries. Each list element would be a dictionary corresponding to a row in the table.</p>
  
  <p>Let's say that the table is:</p>
  
  <p><strong>table</strong></p>
  
  <pre><code>&lt;table style="width:100%"&gt;
    &lt;tr&gt;
      &lt;td&gt;Jill&lt;/td&gt;
      &lt;td&gt;Smith&lt;/td&gt;      
      &lt;td&gt;50&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Eve&lt;/td&gt;
      &lt;td&gt;Jackson&lt;/td&gt;        
      &lt;td&gt;94&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>result</strong></p>
  
  <pre><code>[Jill,  Smith,  50]
  [Eve,   Jackson,    94]
  </code></pre>
  
  <p>I'm achieving this by two ways:</p>
  
  <ol>
  <li><p>Using Xpath :  </p>
  
  <pre><code>page.body.div.table.tr.time;
  </code></pre></li>
  <li><p>Using closure like this:    </p>
  
  <pre><code>page."**".findAll { it.@class.toString().contains("time")}.each {
  </code></pre></li>
  </ol>
  
  <p>Both ways use XMLSlurper:</p>
  
  <pre><code>@Grab(group='org.ccil.cowan.tagsoup', module='tagsoup', version='1.2')
  def parser = new XmlSlurper(new org.ccil.cowan.tagsoup.Parser())
  </code></pre>
  
  <p>So is there another way of getting table values using groovy</p>
  
  <p>Thanks for the help!</p>