title: Parsing html with the HTML Agility Pack and Linq
body: <p>I have the following HTML</p>
  
  <pre><code>(..)
  &lt;tbody&gt;
   &lt;tr&gt;
    &lt;td class="name"&gt; Test1 &lt;/td&gt;
    &lt;td class="data"&gt; Data &lt;/td&gt;
    &lt;td class="data2"&gt; Data 2 &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td class="name"&gt; Test2 &lt;/td&gt;
    &lt;td class="data"&gt; Data2 &lt;/td&gt;
    &lt;td class="data2"&gt; Data 2 &lt;/td&gt;
   &lt;/tr&gt;
  &lt;/tbody&gt;
  (..)
  </code></pre>
  
  <p>The information I have is the name => so "Test1" &amp; "Test2". What I want to know is how can I get the data that's in "data" and "data2" based on the Name I have. </p>
  
  <p>Currently I'm using:</p>
  
  <pre><code>var data =
      from
          tr in doc.DocumentNode.Descendants("tr")
      from   
          td in tr.ChildNodes.Where(x =&gt; x.Attributes["class"].Value == "name")
      where
          td.InnerText == "Test1"
      select tr;
  </code></pre>
  
  <p>But I get  <code>{"Object reference not set to an instance of an object."}</code> when I try to look in <code>data</code></p>