当前位置:编程学习 > C#/ASP.NET >>

C#实现简易RSS

代码如下,欢迎指正

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Xml;
using System.Collections;

namespace FinallyDemo
{
    public partial class frmRSS : Form
    {
        public frmRSS()
        {
            InitializeComponent();
        }
        string url = "";
        string xmlFilePath = "";
        XmlDocument doc = new XmlDocument();
        TreeNode tnroot = new TreeNode();
        public void DownLoadXml(string url)
        {
            if(File.Exists(xmlFilePath))
            {
                File.Delete(xmlFilePath);
            }
            WebClient wc = new WebClient();
            try
            {
                wc.DownloadFile(url, xmlFilePath);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            
        }

        public void LoadXml()
        {
            if(File.Exists(xmlFilePath))
            {
               
                doc.Load(xmlFilePath);
                XmlNode firstNode = doc.DocumentElement.FirstChild;
                XmlNode root = firstNode.FirstChild;
                treeView1.Nodes.Add(root.InnerText);
                tnroot = treeView1.Nodes[0];
            }
        }

        class Test
        {
           public string title;
            public string url;
            

补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,