概要描述:读取XML数据,最终生成Excel数据。
一.新建一个book.xml,代码内容如下:
1
<?xml version="1.0" encoding="utf-8" ?>
2
<bookstore xmlns="http://tempuri.org/Book.xsd">
3
<book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
4
<title>C# Program</title>
5
<author>
6
<first-name>Wang</first-name>
7
<last-name>Lei</last-name>
8
</author>
9
<price>10</price>
10
</book>
11
<book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
12
<title>VB.Net Program</title>
13
<author>
14
<first-name>James</first-name>
15
<last-name>Wang</last-name>
16
</author>
17
<price>8</price>
18
</book>
19
<book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
20
<title>Sql server 2005 database manager</title>
21
<author>
22
<first-name>Elvis</first-name>
23
<last-name>Yu</last-name>
24
</author>
25
<price>5</price>
26
</book>
27
</bookstore>
二.新建一个Default.aspx的页面,在Default.aspx页面上拖放一个按钮,双击进入按钮的事件,代码如下:2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
1
using System;
2
using System.Data;
3
using System.Configuration;
4
using System.Web;
5
using System.Web.Security;
6
using System.Web.UI;
7
using System.Web.UI.WebControls;
8
using System.Web.UI.WebControls.WebParts;
9
using System.Web.UI.HtmlControls;
10
using System.IO;
11
12
public partial class _Default : System.Web.UI.Page
13
文章转载:http://blog.csdn.net/chengking/archive/2006/08/10/1045853.aspx
2
3
4
5
6
7
8
9
10
11
12
13