读取XML节点 - .NET技术 / C#
谁能给个C#中读取XML节点的范例!
XmlDocument pXmlDocument = new XmlDocument();
pXmlDocument.Load(C:\\Config.xml);
XmlNode pDbConnNode = pXmlDocument.SelectSingleNode("ProConfig/Database/Conn");
m_sConn = pDbConnNode.InnerText;
XML code:
Ma Jin Hu 239000 Feng Huang StreetChu Zhou City ANHUI Wang Tian 239000 Lang Ya StreetHe Fei City ANHUI Zou Wen Biao 100000 Sai Di StreetBei Jin CityBei Jin
C# code:
using System ;using System.Drawing ;using System.Collections ;using System.ComponentModel ;using System.Windows.Forms ;using System.Data ;using System.Xml ;public class Form1 : Form{private Button button1 ;private ListView Listview1 ;private System.ComponentModel.Container components = null ;public Form1 ( ){//初始化窗体中的各个组件InitializeComponent ( ) ;}//清除程序中使用过的资源protected override void Dispose ( bool disposing ){if ( disposing ){if ( components != null ) {components.Dispose ( ) ;}}base.Dispose ( disposing ) ;}private void InitializeComponent ( ){button1 = new Button ( ) ;Listview1 = new ListView ( ) ;SuspendLayout ( ) ;button1.Anchor = ( ( AnchorStyles.Bottom | AnchorStyles.Left ) | AnchorStyles.Right ) ;b
相关问答:
DataSet导出xml 批处理(循环)得怎么处理
XML文件
<A>
<B>
<C>
</C>
&nb ......
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
<folder state="unchecked&qu ......
<?xml version="1.0" encoding="utf-8" ?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical&q ......
我有一个类似的xml的 string,想通过遍历怎么个xml 输出我想要的element的值
xml 为:
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_ME ......
思路:要用c#生成一个播放机的播放列表的xml,例如:
<daty datys='2010-04-05' datye='2010-05-01' > //这是播放的日期段
<time times='01:12:00' timee='02:30:00'> ......