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

c# html-agility-pack selectnodes windows-phone

Question

'HtmlAgilityPack.HtmlNode' does not contain a definition for 'SelectNodes' and no extension method 'SelectNodes' accepting a first argument of type 'HtmlAgilityPack.HtmlNode' could be found (are you missing a using directive or an assembly reference?)

I've got configurations like:

The key is here!

HttpClient client = new HttpClient();
        string html = await client.GetStringAsync(Url);
        HtmlDocument htmlDocument = new HtmlDocument();
        htmlDocument.LoadHtml(html);
        var a =htmlDocument.DocumentNode.SelectNodes("//p[@class='verse']");
1
1
8/3/2015 7:56:20 AM

Popular Answer

The Windows Phone HAP version doesn't revealSelectNodes() way since WordPress doesn't have XPath support. To get the same result, you must utilize the HAP LINQ API:

var a = htmlDocument.DocumentNode
                    .Descendants("p")
                    .Where(p => p.GetAttributeValue("class","") == "verse");
2
8/3/2015 7:55:23 AM


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