First attempt at learning to work with HTML in Visual Studio and C#. I am using html agility pack library. to do the parsing.
From this page I am attempting to pull out the numbers from the “Net Income” row for each quarter.
here is my current progress, (But I am uncertain of how to proceed further):
String url = "http://www.google.com/finance?q=NASDAQ:TXN&fstype=ii"
var webGet = new HtmlWeb();
var document = webGet.Load(url);
var body = document.DocumentNode.Descendants()
.Where(n => n.Name == "body")
.FirstOrDefault();
if (body != null)
{
}
Well, first of all there’s no need to get the body first, you can directly query the document for what you want. As for finding the value you’re looking for, this is how you could do it:
Also note the
Trimcalls because there are newlines in the innertext of some elements.