mosflex
mosflex

Reputation: 171

Parse HTML in Windows Phone 8 without HtmlAgilityPack

I'm trying to build a app for Windows Phone 8 i'm trying to parse data from a website.HTMLAgilityPack was the right tool for that but when I load my website

HtmlDocument doc = web.Load(url);

I have this error:

'HtmlAgilityPack.HtmlWeb' does not contain a definition for 'Load' and no extension method 'Load' accepting a first argument of type 'HtmlAgilityPack.HtmlWeb' was found

My question is: There is an other way like HtmlAgilityPack to parse html in windows phone 8 ?

Thanks.

Upvotes: 0

Views: 2930

Answers (2)

Bibaswann Bandyopadhyay
Bibaswann Bandyopadhyay

Reputation: 3547

here is an example from msdn samples: https://code.msdn.microsoft.com/windowsapps/HTML-Parser-Code-MSDN-fe21fd6d

Upvotes: 0

I4V
I4V

Reputation: 35353

That method is not available for WP8, since it doesn't allow async downloads. You should somehow download the page and then load it to HtmlDocument, For example

HttpClient client = new HttpClient();
var html = await client.GetStringAsync("http://stackoverflow.com");

var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);

Upvotes: 4

Related Questions