欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C# 讀取xml文件的示例

c# 讀取xml文件

  • 源碼大?。?span>0.007MB
  • 源碼語言:簡體中文
  • 源碼類型:國產(chǎn)軟件
  • 源碼授權(quán):免費(fèi)軟件
  • 源碼類別:C#源碼
  • 應(yīng)用平臺:Windows平臺
  • 更新時間:2009-07-20
  • 網(wǎng)友評分:
360通過 騰訊通過 金山通過

情介紹

C# 讀取xml文件的示例,核心代碼如下所示:

【核心代碼】

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.Collections;
namespace eg107
{
? ? public partial class Form1 : Form
? ? {
? ? ? ? public Form1()
? ? ? ? {
? ? ? ? ? ? InitializeComponent();
? ? ? ? }
? ? ? ? private void button1_Click(object sender, EventArgs e)
? ? ? ? {
? ? ? ? ? ? Hashtable Htemp = SelectXml("F:\\VS2012\\ReadXML\\BroadCastInfo.xml");
? ? ? ? ? ? richTextBox1.Text ?= string.Format("HashTale Count = {0} " "\n",Htemp.Count);
? ? ? ? ? ? IDictionaryEnumerator IDEum = Htemp.GetEnumerator();
? ? ? ? ? ? while (IDEum.MoveNext())
? ? ? ? ? ? {
? ? ? ? ? ? ? ? richTextBox1.Text ?= IDEum.Key;
? ? ? ? ? ? ? ? richTextBox1.Text ?= IDEum.Value ?"\n";
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? static Hashtable SelectXml(string url)
? ? ? ? {
? ? ? ? ? ? Hashtable HTable = new Hashtable();
? ? ? ? ? ? XmlDocument doc = new XmlDocument();
? ? ? ? ? ? doc.Load(url);
? ? ? ? ? ? XmlNodeList xnl = doc.SelectSingleNode("BCastInfo").ChildNodes;
? ? ? ? ? ? string key = "";
? ? ? ? ? ? string value = "";
? ? ? ? ? ? foreach (XmlNode xn in xnl)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? XmlElement xe = (XmlElement)xn;
? ? ? ? ? ? ? ? if (xe.Name == "DInfo")
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? XmlNodeList xnlChild1 = xn.ChildNodes;
? ? ? ? ? ? ? ? ? ? foreach (XmlNode xnchild in xnlChild1)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? XmlElement xeChild1 = (XmlElement)xnchild;
? ? ? ? ? ? ? ? ? ? ? ? if (xeChild1.Name == "Address")
? ? ? ? ? ? ? ? ? ? ? ? ? ? key = xeChild1.InnerText;
? ? ? ? ? ? ? ? ? ? ? ? else if (xeChild1.Name == "Name")
? ? ? ? ? ? ? ? ? ? ? ? ? ? value = xeChild1.InnerText;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? HTable.Add(key, value);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? return HTable;
? ? ? ? }
? ? }
}

載地址

下載錯誤?【投訴報錯】

氣源碼

關(guān)文章

載聲明

☉ 解壓密碼:www.dbjr.com.cn 就是本站主域名,希望大家看清楚,[ 分享碼的獲取方法 ]可以參考這篇文章
☉ 推薦使用 [ 迅雷 ] 下載,使用 [ WinRAR v5 ] 以上版本解壓本站軟件。
☉ 如果這個軟件總是不能下載的請?jiān)谠u論中留言,我們會盡快修復(fù),謝謝!
☉ 下載本站資源,如果服務(wù)器暫不能下載請過一段時間重試!或者多試試幾個下載地址
☉ 如果遇到什么問題,請?jiān)u論留言,我們定會解決問題,謝謝大家支持!
☉ 本站提供的一些商業(yè)軟件是供學(xué)習(xí)研究之用,如用于商業(yè)用途,請購買正版。
☉ 本站提供的C# 讀取xml文件的示例資源來源互聯(lián)網(wǎng),版權(quán)歸該下載資源的合法擁有者所有。