Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Scraping of HTML/.asp
    text
    copied!<p>I'm working on a "personal-can-it-work" sort of thing, and i have everything working great except for trying to parse some information from a .asp sourcefile into my Program. </p> <p>This is the parsing code i have so far</p> <pre><code> // parse out the results try { int snr_start = result.IndexOf("SNR"); int snr_end = result.IndexOf("&lt;/TR&gt;", snr_start); snr = result.Substring(snr_start, snr_end - snr_start); snr = snr.Substring(snr.IndexOf("&lt;TD&gt;") + 1); snr = snr.Substring(0, snr.Length - 6); iSNR = Convert.ToInt32(snr.Substring(0, snr.IndexOf(" "))); int dnpwr_start = result.IndexOf("Downstream Power", snr_end); int dnpwr_stop = result.IndexOf("&lt;/TR&gt;", dnpwr_start); dnpwr = result.Substring(dnpwr_start, dnpwr_stop - dnpwr_start); dnpwr = dnpwr.Substring(dnpwr.IndexOf("&lt;TD&gt;") + 1); dnpwr = dnpwr.Substring(0, dnpwr.IndexOf("&lt;TABLE") - 1); iDPWR = Convert.ToInt32(dnpwr.Substring(0, dnpwr.IndexOf(" "))); int uppwr_start = result.IndexOf("Upstream Power", dnpwr_stop); int uppwr_stop = result.IndexOf("&lt;/TR&gt;", uppwr_start); uppwr = result.Substring(uppwr_start, uppwr_stop - uppwr_start); uppwr = uppwr.Substring(uppwr.IndexOf("&lt;TD&gt;") + 1); uppwr = uppwr.Substring(0, uppwr.IndexOf("&lt;/TD&gt;") - 1); iUPWR = Convert.ToInt32(uppwr.Substring(0, uppwr.IndexOf(" "))); } catch </code></pre> <p>And this is the Sourcefile and the Information i'm trying to scrape from it (SNR, Downstream Power, Upstream Power)</p> <pre><code>&lt;td class="headerR"&gt;Downstream Power&lt;/td&gt; &lt;td class="contentL"&gt;1.0 dBmV&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="headerR"&gt;SNR&lt;/td&gt; &lt;td class="contentL"&gt;39.656 dB&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="headerR"&gt;Upstream Power&lt;/td&gt; &lt;td class="contentL"&gt;42.0 dBmV&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Not too sure where i'm going wrong to, but any helpwould be greatly appreaciated. The focus of the project is so i can parse the signal levels off of my modem (I'm a MSO employee) for extended monitoring. If needed i can post the full source from the .asp page</p> <p>Thanks, Matt</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload