不挣扎了,开始学习LINQ TO XML,进而来解析网页。

找到了别人遇到和我一样的问题:http://ylad.codeplex.com/discussions/430095(英文)

一位叫做Mister Goodcat的提供了信息:

Short answer: XPath is not supported on the phone. If you want to use HTML Agility Pack, use the LinqToXml features instead.

Long version: 
Enabling the XPath features on Windows Phone only works, as you stated, when you add a reference to the System.Xml.XPath assembly of the Silverlight 4 SDK. This is considered an unsupported workaround to add XPath support to Windows Phone which worked in the past on 7.x (also note the warning you receive in Visual Studio when you add the reference, about unexpected behavior). In Windows Phone 8, this trick doesn‘t seem to work anymore (see also Mathias comment here, for example). 
Apparently there now is a System.Xml.XPath assembly (version 4.0.0.0, as opposed to version 2.0.5.0 from the Silverlight SDK) that is internally used by the XAML page loader. Now when you add the Silverlight SDK version the result is a conflict between these involved assemblies that cannot be resolved.

是因为System.Xml.XPath 冲突了。并建议在使用HTML Agility Pack时不要使用System.Xml.XPath,而可用LinqToXml替代。

而且HTML Agility Pack在WP8  WP8.1上也缺少方法,导致不能使用Xpath来解析

所以不挣扎了,现在开始要学习LINQ TO XML了。

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。