日期:2014-05-17 浏览次数:20478 次
<?xml version="1.0" encoding="utf-8"?>
<world>
<continet text="南美洲">
<country>哥伦比亚</country>
<country>委内瑞拉</country>
<country>圭亚那</country>
<country>法属圭亚那</country>
<country>苏里南</country>
<country>厄瓜多尔</country>
<country>秘鲁</country>
<country>玻利维亚</country>
<country>巴西</country>
<country>智利</country>
<country>阿根廷</country>
<country>乌拉圭</country>
<country>巴拉圭</country>
</continet>
</world>
string strXmlFile = Server.MapPath("test.xml");
DataSet ds = new DataSet();
ds.ReadXml(strXmlFile);
GridView1.DataSource = ds.Tables[1];
GridView1.DataBind();
------解决方案--------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs" Inherits="Default6" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
<%# ((System.Xml.XmlNode)Container.DataItem).InnerText%>
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>