HTML Agility Pack SelectSingleNode方法未在通用应用程序(C#)中列出
我正在用C语言开发一个简单的网页抓取应用程序,下面是我的代码,用于将从服务器接收到的html代码加载到HTML Agility Pack SelectSingleNode方法未在通用应用程序(C#)中列出,c#,html-agility-pack,C#,Html Agility Pack,我正在用C语言开发一个简单的网页抓取应用程序,下面是我的代码,用于将从服务器接收到的html代码加载到HtmlDocument string html = res.Content.ToString(); HtmlDocument htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(html); 每当我尝试使用htmlDoc.DocumentNode.SelectSingleNode方法时,都会出现以下错误: “Html节点不包含SelectSingle
HtmlDocument
string html = res.Content.ToString();
HtmlDocument htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(html);
每当我尝试使用htmlDoc.DocumentNode.SelectSingleNode
方法时,都会出现以下错误:
“Html节点不包含SelectSingleNode的引用”
我错过什么了吗
我正在Visual Studio 2015中开发一个通用应用程序。使用Nuget manager下载并安装了html agility pack。通用应用程序不支持XPath。因此,不能使用SelectSingleNode或SelectNodes方法。但是你可以使用Linq,比如
doc.DocumentNode.Descendants("a")
.Where(a => a.InnerText.Contains("some text"))
.Select(a => a.Attributes["href"].Value);
要获得相同的节点您的XPath语法是什么?提供完整的代码。保留语法。。我甚至没有将该方法显示在intellisense上。@Sirwanafi发问:
我正在Visual Studio 2015中开发一个通用应用程序
,我想这很清楚。你怎么认为?