c#中操作XMLDOM解析XML文件

很简单,怕忘记,写在这里.

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

namespace WindowsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            XmlDocument XMLDom = new XmlDocument();  
            XMLDom.Load("http://www.dc9.cn/rss.xml");
            XmlNodeList newXMLNodes = XMLDom.SelectNodes("/rss/channel/item");
            foreach (XmlNode xn in newXMLNodes)
            {
                string title = xn.SelectSingleNode("title").InnerXml;
                MessageBox.Show(title);

            }


        }
    }
}

2 comments

  1. Chance Gapinski 说道:

    I just want to mention I am just new to blogs and certainly liked you’re website. Most likely I’m likely to bookmark your website . You really come with very good posts. Kudos for revealing your blog.

  2. Akiko Vadnais 说道:

    My family members always say that I am killing my time here at net, except I know I am getting familiarity everyday by reading such pleasant posts.

发表评论

电子邮件地址不会被公开。