不挣扎了,开始学习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了。

 

你可能感兴趣的:(LINQ)