这种格式是可以的
<Demographics> |
<StoreSurvey> |
<AnnualSales>300000</AnnualSales> |
<AnnualRevenue>30000</AnnualRevenue> |
<BankName>International Bank</BankName> |
<BusinessType>BM</BusinessType> |
<YearOpened>1970</YearOpened> |
<Specialty>Road</Specialty> |
<SquareFeet>7000</SquareFeet> |
<Brands>AW</Brands> |
<Internet>T1</Internet> |
<NumberEmployees>2</NumberEmployees> |
</StoreSurvey> |
<StoreSurvey> |
<AnnualSales>300000</AnnualSales> |
<AnnualRevenue>30000</AnnualRevenue> |
<BankName>International Bank</BankName> |
<BusinessType>BM</BusinessType> |
<YearOpened>1970</YearOpened> |
<Specialty>Road</Specialty> |
<SquareFeet>7000</SquareFeet> |
<Brands>AW</Brands> |
<Internet>T1</Internet> |
<NumberEmployees>2</NumberEmployees> |
</StoreSurvey> |
<StoreSurvey> |
<AnnualSales>300000</AnnualSales> |
<AnnualRevenue>30000</AnnualRevenue> |
<BankName>International Bank</BankName> |
<BusinessType>BM</BusinessType> |
<YearOpened>1970</YearOpened> |
<Specialty>Road</Specialty> |
<SquareFeet>7000</SquareFeet> |
<Brands>AW</Brands> |
<Internet>T1</Internet> |
<NumberEmployees>2</NumberEmployees> |
</StoreSurvey> |
</Demographics> |
aspx
<%@ Page Language="C#" %> |
<!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 id="Head1" runat="server"> |
<title></title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XMLFile.xml"></asp:XmlDataSource> |
<asp:GridView ID="GridView1" runat="server" DataSourceID="XmlDataSource1" AutoGenerateColumns="false"> |
<Columns> |
<asp:TemplateField> |
<ItemTemplate> |
<%#XPath("/Demographics/StoreSurvey/AnnualSales")%> |
<%#XPath("/Demographics/StoreSurvey/BankName")%> |
<%#XPath("/Demographics/StoreSurvey/BusinessType")%> |
</ItemTemplate> |
</asp:TemplateField></Columns> |
</asp:GridView> |
</form> |
</body> |
</html> |