title: Screen Scraping HTML with C#
body: <p>I have been given the task at work of screen scraping one of our legacy web apps to extract certain data from the code. The data is formatted and "should" be displayed exactly the same every time. I am just not sure how to go about doing this. It's a full html file with header and footer navigations but in the middle of all this is the data I need. </p>
  
  <p>I need to extract the Company Name value, Contact Name, Telephone, email address, etc.</p>
  
  <p>Here is an example of what the code looks like:</p>
  
  <pre><code>...html above here
  
  &lt;br /&gt;&lt;br /&gt;
  &lt;table cellpadding="0" cellspacing="12" border="0"&gt;
      &lt;tr&gt;
          &lt;td valign="top" align="center"&gt;
              &lt;!-- Company Info --&gt;
  
              &lt;table cellpadding="0" cellspacing="0" border="0"&gt;
                  &lt;tr&gt;
                      &lt;td class="black"&gt;
                          &lt;table cellspacing="1" cellpadding="0" border="0" width="370"&gt;
                              &lt;tr&gt;
                                  &lt;th&gt;ABC INDUSTRIES&lt;/th&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td class="search"&gt;
  
                                      &lt;table cellpadding="5" cellspacing="0" border="0" width="100%"&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;table cellpadding="1" cellspacing="0" border="0" width="100%"&gt;
                                                     &lt;tr&gt;
                                                          &lt;td align="center" colspan="2"&gt;&lt;hr&gt;&lt;/td&gt;
                                                      &lt;/tr&gt;
                                                      &lt;tr&gt;
                                                          &lt;td align="right" nowrap&gt;&lt;b&gt;&lt;font color="FF0000"&gt;Contact Person&amp;nbsp;&lt;img src="/images/icon_contact.gif" align="absmiddle"&gt;&amp;nbsp;:&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
                                                          &lt;td align="left" width="100%"&gt;&amp;nbsp;Joe Smith&lt;/td&gt;
                                                      &lt;/tr&gt;
                                                      &lt;tr&gt;
                                                          &lt;td align="right" nowrap&gt;&lt;b&gt;&lt;font color="FF0000"&gt;Phone Number&amp;nbsp;&lt;img src="/images/icon_phone.gif" align="absmiddle"&gt;&amp;nbsp;:&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
                                                          &lt;td align="left" width="100%"&gt;&amp;nbsp;555-555-5555&lt;/td&gt;
                                                      &lt;/tr&gt;
                                                      &lt;tr&gt;
                                                          &lt;td align="right" nowrap&gt;&lt;b&gt;&lt;font color="FF0000"&gt;E-mail Address&amp;nbsp;&lt;img src="/images/icon_email.gif" align="absmiddle"&gt;&amp;nbsp;:&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
                                                          &lt;td align="left" width="100%"&gt;&amp;nbsp;&lt;a HREF="mailto:joe@joe.com"&gt;joe@joe.com&lt;/a&gt;&lt;/td&gt;
                                                      &lt;/tr&gt;
                                                      more...
  </code></pre>
  
  <p>There is more code on the screen in a different table structure that I also need to pull.</p>