小编use*_*078的帖子

从XmlDocument到XmlReader .Net

在回答了我的问题的用户的建议后,我想将我的XmlDocument代码转换为XmlReader代码,但我遇到了一些麻烦.

这是XML(从php-mysql页面生成)

<row>
<idLink>64</idLink>
<idHost>3</idHost>
<url>http://www.google.com</url>
</row>
<row>
<idLink>68</idLink>
<idHost>4</idHost>
<url>http://www.bing.com</url>
</row>
..... until about 10000 rows
Run Code Online (Sandbox Code Playgroud)

这是我的XmlDocument代码:

   xmlDoc.Load("http://www.myUrl.com/list.php");
      if (xmlDoc.DocumentElement != null){
          foreach (XmlNode node in xmlDoc.DocumentElement)
             {
              if (node.Name == "row")
                {
                  list.Add(new Links { 
                       idLink = Convert.ToInt32(node.ChildNodes[0].InnerText),
                       idHost = Convert.ToInt32(node.ChildNodes[1].InnerText),
                       url = node.ChildNodes[2].InnerText }); 
                  }
             }  
             return list;
Run Code Online (Sandbox Code Playgroud)

现在我在XmlReader中转换有一些麻烦,我尝试了很多代码,但我无法处理它.

using (XmlReader reader = new XmlTextReader("http://myUrl.com/list.php"))
         { 
          if (reader.NodeType == XmlNodeType.Element) 
           ?????
Run Code Online (Sandbox Code Playgroud)

.net xmldocument xmlreader

18
推荐指数
2
解决办法
4万
查看次数

WinApp表单崩溃没有任何错误或异常.Net

我的MyApp Form程序有一个问题,它包含一个带WebBrowser控件DLL(GeckoFX)的选项卡Control.

我的应用程序在关闭时没有任何异常或任何东西.它可能在几分钟后或10分钟后最大值发生.在visual studio中,我看到应用程序以代码0终止.任何事情.

在program.cs中,我抓住了所有这些未处理的重复

` // Add the event handler for handling UI thread exceptions to the event.
                 Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(UIThreadException);

  // Set the unhandled exception mode to force all Windows Forms errors to go through
    // our handler.
                  Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

 // Add the event handler for handling non-UI thread exceptions to the event. 
                 AppDomain.CurrentDomain.UnhandledException +=
                     new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);`
Run Code Online (Sandbox Code Playgroud)

我已经在Windows事件记录器中检查是否有任何错误,但它很干净.就像程序终止得好.我不知道它是否是Gecko DLL故障,但我不这么认为.

我使用httpWebRequest下载包含一些URL的列表.

然后我使用a Backgroundworker读取URL列表,并调用addTab Delegate Method Sleep,直到加载页面并继续其他AddTab Invoke.

当列表为空时,我检查在DOM页面中是否有某个字符串然后在Backgroundworker完成我关闭所有选项卡并处理它们然后我点击button1启动Backgroundworker1.asyncall();

我的逻辑有什么问题吗?我也会发布代码,我需要它太长但我真的需要了解哪里可能是终止我的应用程序的错误.如果有人可以帮我看看为什么它崩溃没有任何错误或任何我会欣赏的.

private void Start_Back_Click(object sender, EventArgs e) …
Run Code Online (Sandbox Code Playgroud)

.net c# exception winforms

12
推荐指数
1
解决办法
4978
查看次数

标签 统计

.net ×2

c# ×1

exception ×1

winforms ×1

xmldocument ×1

xmlreader ×1