title: Html Agility Pack: how to scrape <tr> text?
body: <pre><code>&lt;tr id='tr1' align='center' border=0 class='headerclass'&gt;
    Example text
    &lt;tr id='tr11' align='center' border=0 bgColor='99ccff'&gt; 
      &lt;td id='td1' class='headerclass'&gt;Example Header 1 &lt;/td&gt;
      &lt;td id='td2' class='headerclass'&gt;Example Header 2 &lt;/td&gt;
      &lt;td id='td3' class='headerclass'&gt;Example Header 3 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr id='tr12' align='center"'bgColor='white'&gt;
      &lt;td id='v1' class='colclass'&gt;value 1&lt;/td&gt;
      &lt;td id='v2' class='colclass'&gt;value 2&lt;/td&gt;
      &lt;td id='v3' class='colclass'&gt;value 3&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Above is the HTML example that I wanted to scrape. I want to get <em>Example text</em> which is in <code>&lt;tr&gt;&lt;/tr&gt;</code>. I tried to use <em>InnerText</em> (code as shown below) but it returns me all the text in <code>&lt;td&gt;&lt;/td&gt;</code> as well which is not what I want. I would like to get <em>Example text</em> only. </p>
  
  <pre><code>var nodes = htmlDoc.DocumentNode.SelectNodes("//tr").Where(x =&gt; x.Attributes["id"] != null &amp;&amp; x.Attributes["id"].Value.Contains("tr1"));
  foreach (var htmlNode in nodes)
  {
     Console.WriteLine(htmlNode.InnerText);
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Example text
  Example Header 1
  Example Header 2
  Example Header 3 
  value 1
  value 2
  value 3
  </code></pre>
  
  <p>Thank you.</p>