请教高手!!!!
epcode.xml文件内容
<?xml version="1.0" encoding="utf-8"?>
<EpTable>
  <Examplace>
    <EpName>第010考场</EpName>
    <EpAddr>007</EpAddr>
    <FExamcode>131200700101806</FExamcode>
    <LExamcode>445200700101006</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第011考场</EpName>
    <EpAddr>008</EpAddr>
    <FExamcode>445200700101007</FExamcode>
    <LExamcode>445200700101216</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第012考场</EpName>
    <EpAddr>009</EpAddr>
    <FExamcode>445200700101217</FExamcode>
    <LExamcode>445200700101316</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第013考场</EpName>
    <EpAddr>010</EpAddr>
    <FExamcode>445200700101317</FExamcode>
    <LExamcode>445200700101136</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第014考场</EpName>
    <EpAddr>010</EpAddr>
    <FExamcode>445200700101137</FExamcode>
    <LExamcode>445200700101406</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第015考场</EpName>
    <EpAddr>010</EpAddr>
    <FExamcode>445200700101407</FExamcode>
    <LExamcode>445200700101506</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第016考场</EpName>
    <EpAddr>011</EpAddr>
    <FExamcode>445200700101507</FExamcode>
    <LExamcode>445200700101606</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第017考场</EpName>
    <EpAddr>012</EpAddr>
    <FExamcode>445200700101607</FExamcode>
    <LExamcode>445200700101706</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第018考场</EpName>
    <EpAddr>013</EpAddr>
    <FExamcode>445200700101707</FExamcode>
    <LExamcode>445200700101926</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第019考场</EpName>
    <EpAddr>014</EpAddr>
    <FExamcode>445200700101927</FExamcode>
    <LExamcode>445200700102116</LExamcode>
  </Examplace>
  <Examplace>
    <EpName>第020考场</EpName>
    <EpAddr>015</EpAddr>
    <FExamcode>445200700102117</FExamcode>
    <LExamcode>545200700102132</LExamcode>
  </Examplace>
</EpTable>aspx页面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="xml操作_Default" %><!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 class="main_bg">
    <form id="form1" runat="server">
    <div style=" text-align:center">
        <asp:GridView ID="GridView1" DataSourceID="xds" Width="90%" runat="server" AutoGenerateColumns="false" >
        <Columns>
        <asp:TemplateField>
        <HeaderTemplate>
        <table cellpadding="0" cellspacing="0" width= "100%">
        <tr>
        <td style="width:20%">考场</td>
        <td style="width:30%">地址</td>
        <td style="width:50%">准考证号范围</td>
        </tr>
        </table>
        </HeaderTemplate>
        <ItemTemplate>
        <table cellpadding="0" cellspacing="0" border="0"  width= "100%">
        <tr>
        <td style="width:20%"><%# XPath("Examplace/EpName")%></td>
        <td style="width:30%"><%# XPath("Examplace/EpAddr")%></td>
        <td style="width:50%"><%# XPath("Examplace/FExamcode") + "---" + XPath("Examplace/LExamcode")%>
        </td>        
        </tr>
        </table>
        </ItemTemplate>
        </asp:TemplateField>
        </Columns>
        </asp:GridView>              
    </div>
    
      <asp:XmlDataSource ID="xds" XPath="/EpTable" DataFile="eptable.xml" runat="server"></asp:XmlDataSource>  
    </form>
</body>
</html>

解决方案 »

  1.   

    <asp:XmlDataSource ID="xds" XPath="/EpTable" DataFile="eptable.xml" runat="server"> </asp:XmlDataSource>  
    换成
    <asp:XmlDataSource ID="xds" XPath="/EpTable" DataFile="~/epcode.xml" runat="server"> </asp:XmlDataSource> 
      

  2.   

    不好意思,xml文件名是对的,上面写错了我更正下
    请教高手!!!! 
    eptable.xml文件内容 
    <?xml version="1.0" encoding="utf-8"?> 
    <EpTable> 
      <Examplace> 
        <EpName>第010考场 </EpName> 
        <EpAddr>007 </EpAddr> 
        <FExamcode>131200700101806 </FExamcode> 
        <LExamcode>445200700101006 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第011考场 </EpName> 
        <EpAddr>008 </EpAddr> 
        <FExamcode>445200700101007 </FExamcode> 
        <LExamcode>445200700101216 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第012考场 </EpName> 
        <EpAddr>009 </EpAddr> 
        <FExamcode>445200700101217 </FExamcode> 
        <LExamcode>445200700101316 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第013考场 </EpName> 
        <EpAddr>010 </EpAddr> 
        <FExamcode>445200700101317 </FExamcode> 
        <LExamcode>445200700101136 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第014考场 </EpName> 
        <EpAddr>010 </EpAddr> 
        <FExamcode>445200700101137 </FExamcode> 
        <LExamcode>445200700101406 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第015考场 </EpName> 
        <EpAddr>010 </EpAddr> 
        <FExamcode>445200700101407 </FExamcode> 
        <LExamcode>445200700101506 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第016考场 </EpName> 
        <EpAddr>011 </EpAddr> 
        <FExamcode>445200700101507 </FExamcode> 
        <LExamcode>445200700101606 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第017考场 </EpName> 
        <EpAddr>012 </EpAddr> 
        <FExamcode>445200700101607 </FExamcode> 
        <LExamcode>445200700101706 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第018考场 </EpName> 
        <EpAddr>013 </EpAddr> 
        <FExamcode>445200700101707 </FExamcode> 
        <LExamcode>445200700101926 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第019考场 </EpName> 
        <EpAddr>014 </EpAddr> 
        <FExamcode>445200700101927 </FExamcode> 
        <LExamcode>445200700102116 </LExamcode> 
      </Examplace> 
      <Examplace> 
        <EpName>第020考场 </EpName> 
        <EpAddr>015 </EpAddr> 
        <FExamcode>445200700102117 </FExamcode> 
        <LExamcode>545200700102132 </LExamcode> 
      </Examplace> 
    </EpTable> aspx页面 
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="xml操作_Default" %> <!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 class="main_bg"> 
        <form id="form1" runat="server"> 
        <div style=" text-align:center"> 
            <asp:GridView ID="GridView1" DataSourceID="xds" Width="90%" runat="server" AutoGenerateColumns="false" > 
            <Columns> 
            <asp:TemplateField> 
            <HeaderTemplate> 
            <table cellpadding="0" cellspacing="0" width= "100%"> 
            <tr> 
            <td style="width:20%">考场 </td> 
            <td style="width:30%">地址 </td> 
            <td style="width:50%">准考证号范围 </td> 
            </tr> 
            </table> 
            </HeaderTemplate> 
            <ItemTemplate> 
            <table cellpadding="0" cellspacing="0" border="0"  width= "100%"> 
            <tr> 
            <td style="width:20%"> <%# XPath("Examplace/EpName")%> </td> 
            <td style="width:30%"> <%# XPath("Examplace/EpAddr")%> </td> 
            <td style="width:50%"> <%# XPath("Examplace/FExamcode") + "---" + XPath("Examplace/LExamcode")%> 
            </td>        
            </tr> 
            </table> 
            </ItemTemplate> 
            </asp:TemplateField> 
            </Columns> 
            </asp:GridView>              
        </div> 
        
          <asp:XmlDataSource ID="xds" XPath="/EpTable" DataFile="eptable.xml" runat="server"> </asp:XmlDataSource>  
        </form> 
    </body> 
    </html>