读XML 的方式 。NET

XmlDocument xmlDoc =  new  XmlDocument();
             xmlDoc.Load( "titles.xml" );
             XmlNode xn = xmlDoc.SelectSingleNode( "items" );
  
                XmlNodeList xnl=xn.ChildNodes;
                foreach  (XmlNode xnf  in  xnl)
                {
                    XmlElement xe = (XmlElement)xnf;
                    Console.Write( "类别  " +xe.GetAttribute( "类别" )+ "     品质  " ); //显示属性值
                    Console.WriteLine(xe.GetAttribute( "品质" ));
                    XmlNodeList xnf1 = xe.ChildNodes;
                    foreach  (XmlNode xn2  in  xnf1)
                    {
                        Console.WriteLine(xn2.InnerText); //显示子节点点文本
                    }
                    Console.WriteLine();
                }

myWebClient.DownloadFile(New Uri(strOldPath), strNewPath)
,总是提示出错! "未能找到路径中的某一部分" 怎么回事呢? 请指教,谢谢!

------解决方案--------------------
destFileName
目标文件的名称。不能是目录。
myWebClient.DownloadFileAsync(New Uri(strOldPath), strNewPath)
'下面代码放到myWebClient下载进度事件里,并判断下载结束后调用
  myWebClient.Dispose()
  myWebClient = Nothing
  TxtBoxLog.Text = "完成下载:" + strOldPath & vbCrLf & TxtBoxLog.Text  

猜你喜欢

转载自blog.csdn.net/jing_xin/article/details/51567182