C#读取XML文件的简单方法
一、XML只有一个Table的情况
(1)userInfo.xml
<?xml version="1.0" encoding="utf-8" ?>
<UserInfo>
<user userName ="张三" sex ="男" dept="财务部门"/>
<user userName ="李四" sex ="女" dept="资讯部门"/>
<user userName ="王五" sex ="男" dept="生产部门"/>
</UserInfo>
(2)读取资料
DataSet ds = new DataSet();
ds.ReadXml(@"userInfo.xml");
dataGridView1.DataSource = ds.Tables["user"];
二、XML有多个Table的情况
(1)userInfo.xml
<?xml version="1.0" encoding="utf-8" ?>
<SystemData>
<user id ="1">
<userName>张三</userName>
<sex>男</sex>
<dept>财务部门</dept>
</user>
<user id="2">
<userName>李四</userName>
<sex>女</sex>
<dept>资讯部门</dept>
</user>
<user id="3">
<userName>王五</userName>
<sex>男</sex>
 
相关文档:
源xml文件
<?xml version="1.0" encoding="iso-8859-1"?>
<books>
<stock>
<name>The Picasso Code</name>
<author>Dan Blue</author>
<category>Fiction</category>
<description>Cubist paintings reveal a secret society of people ......
先创建数据然后生成相应的xml文件
DataSet ds = new DataSet();
#region Parent Table
DataTable dt1 = new DataTable("Parent");
......
C/C++关键字static,const,inline,define,typedef
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
......
头文件一般由三部分内容组成:(1)头文件开头处的版权和版本声明;(2)预处理块;(3)函数和类结构声明等。
头文件扩展名为*.h。
为避免出现重复定义的问题 ,头文件一般写法如下:
/*----------------------------------------------------
MATH.H
-------------------------------------------------------*/
#ifndef& ......
精短高效的XML解析器,纯C单一程序,应用于银行的国税库行横向联网接口系统中,稳定可靠,运行速度飞快,非相应的JAVA程序可比.以下为大部分源码:
/* Copyright (c) 2005 wzs */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <varargs.h>
#i ......