Jovica Bozic
Jovica Bozic

Reputation: 97

Extract data with HTMLAgilityPack – simple example

I've searched the net and can not find simple HTMLAgilityPack example to extract 1 information from webpage. Most of the examples are in C# and code convertors don't work properly. Also developer's forum wasn't helpful.

Anyways, I am trying to extract “Consumer Defensive” string from this URL “http://quotes.morningstar.com/stock/c-company-profile?t=dltr” and this text “Dollar Tree Stores, Inc., operates discount variety stores in United States and Canada. Its stores offer merchandise at fixed price of $1.00 and C$1.25. The company operates stores under the names of Dollar Tree, Deal$, Dollar Tree Canada, etc. “ from same webpage.

Tried code on this link : https://stackoverflow.com/questions/13147749/html-agility-pack-with-vb-net-parsing but GetPageHTML is not declared. This one is in C# HTML Agility pack - parsing tables and so on.

Thanks.

Upvotes: 0

Views: 620

Answers (1)

Phillip Trelford
Phillip Trelford

Reputation: 6543

The HTML returned from that URL is translated to XML with 2 root nodes, so it can not be transformed directly to an XML document.

For the values you wish to retrieve it may be easier to simply retrieve the HTML document and search for the start and end tags of the strings you wish to extract.

Upvotes: 1

Related Questions