string
2014-09-22 54 views 0 likes 
0

我只是試圖分配這是我從HTML頁面鑽進一個字符串值,但它在App.xaml.cs未能分配的XPath值串

未能在該方法Application_UnhandledException雖然我是新來的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(); 
     } 
    } 

回答

0

在失敗後Application_UnhandledException幾天,我想通了這一點。只需在下面的代碼加載Html文檔之前修正xml的行爲,然後按以下代碼加載該代碼

HtmlAgilityPack.HtmlNode.ElementsFlags.Remove("img"); 
相關問題