HtmlAgilityPack和放大器; Windows 8的地铁应用程序 [英] HtmlAgilityPack & Windows 8 Metro Apps

查看:176
本文介绍了HtmlAgilityPack和放大器; Windows 8的地铁应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让HtmlAgilityPack与Windows 8地铁应用程序(Windows应用商店的应用程序)的工作。我已经成功地写出所有code,我需要在Windows控制台应用程序(C#)和它的作品完美解析我需要的HTML并返回我所要求的字符串,我需要。

I'm trying to get HtmlAgilityPack to work with Windows 8 Metro Apps (Windows Store Apps). I've successfully written out all the code I need in a Windows Console App (C#) and it works perfectly for parsing the HTML I need and returning me the required string I need.

// Create a new HtmlDocument and load the incoming string
        HtmlDocument menu = new HtmlDocument();
        menu.OptionUseIdAttribute = true;
        menu.LoadHtml(response);

        HtmlNode nameToRemove = menu.DocumentNode.SelectSingleNode("//*[@id=\"maincontent_0_contentplaceholder_0_lblHall\"]");

我的问题是与 DocumentNode.SelectSingleNode 通话。我收到以下错误:

My problem is with the DocumentNode.SelectSingleNode call. I'm getting the following error:

错误2HtmlAgilityPack.HtmlNode'不包含一个定义   的SelectSingleNode',没有扩展方法的SelectSingleNode   接受第一种类型HtmlAgilityPack.HtmlNode的说法可能是   (是否缺少using指令或程序集引用?)

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

我证实,我有所有引用的设置完全相同的方式,我的控制台应用程序做,但我无法得到这个工作。按照HtmlAgilityPack Twitter账户,为Windows 8地铁/的Windows Phone 8支持中添加了1.4.5版本。我双重检查我的NuGet包管理器,我已经安装了1.4.6。

I'm confirmed that I have all of the references setup the exact same way I did in the Console Application but am unable to get this to work. According to the HtmlAgilityPack twitter account, support for Windows 8 Metro/Windows Phone 8 was added in version 1.4.5. I'm double checked my NuGet Package Manager and I have 1.4.6 installed.

有什么特别的,我需要做的,在Windows 8应用的的HTMLDocument选择一个节点通过的XPath ?任何建议将是非常美联社preciated。

Is there something special that I need to do to select a node by XPath in an HtmlDocument in a Windows 8 App? Any suggestions would be highly appreciated.

谢谢!

编辑:任何人都可以帮助我得到一个LINQ查询相同的结果呢。我不知道我怎么会去了。

Can anyone help me get the same results with a Linq query then. I'm not sure how I would go about it.

推荐答案

在HTML敏捷性包依赖于.NET的XPath实现。不幸的是,WinRT的并不支持XPATH,这样你就没有任何东西可以WinRT的有关XPATH在HTML敏捷性包。

The Html Agility Pack relies on .NET for the XPATH implementation. Unfortunately, WinRT doesn't support XPATH, so you don't have anything related to XPATH in Html Agility Pack for WinRT.

这篇关于HtmlAgilityPack和放大器; Windows 8的地铁应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆