HtmlAgilityPack.HtmlNode no definition for SelectNodes

c# html-agility-pack windows-phone-8

Question

I'm attempting to locate items on a website using the HTML Agility Pack. My issue is as follows:

I developed a (c#) universal Windows 8 app.

I included: using the NuGet Manager.

using System.Net.Http;
using HtmlAgilityPack;

I then did:

string htmlPage;
using (var client = new HttpClient())
{
    htmlPage = await client.GetStringAsync("http://www.domain.de/");
}

HtmlDocument myDocument = new HtmlDocument();
myDocument.LoadHtml(htmlPage);

//this line results an error @ "SelectNodes"
var metaTags = myDocument.DocumentNode.SelectNodes("//meta");

However, Visual Studio claims:

Error 1 'HtmlAgilityPack.HtmlNode' does not contain a definition for 'SelectNodes'

I had researched the issue, but all solutions just fixed a different issue where the code read "DocumentElement" rather than "DocumentNode."

Have you got any pointers?

Thanks!

1
6
1/4/2015 1:59:25 PM

Accepted Answer

Yes, SelectNodes is not supported by WP8, however you may still use;

var metaTags = myDocument.DocumentNode.Descendants("meta");

instead.

8
1/4/2015 2:06:57 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow