String 无法将Xpath值分配给字符串
我只是尝试将从html页面获得的值赋给字符串,但在App.xaml.cs中的方法应用程序_UnhandledException中失败String 无法将Xpath值分配给字符串,string,String,我只是尝试将从html页面获得的值赋给字符串,但在App.xaml.cs中的方法应用程序_UnhandledException中失败 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { // An unhandled exce
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
Debugger.Break();
}
}
虽然我是WP8新手,但请帮助我理解原因并修复它。谢谢大家
我的代码:
HtmlAgilityPack.HtmlNode imageNode = doc.DocumentNode.SelectSingleNode("//div[@class='fck_detail width_common']/table/img[@src]");
string imgUrl = imageNode.Attributes["src"].Value;
在App.xaml.cs中的应用程序_未处理异常时失败
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
Debugger.Break();
}
}
几天后,我明白了这一点。在通过下面的代码加载Html文档之前,只需将xml的行为修改1行
HtmlAgilityPack.HtmlNode.ElementsFlags.Remove("img");