我试图在我的 asp.NET 页面上显示以下 XML 文件,但它不起作用。
<Calendar>
<Info>
<CalendarID>95</CalendarID>
<CalendarName>
<![CDATA[ Kalender Jebjerg ]]>
</CalendarName>
<AppointmentInterval>1 days</AppointmentInterval>
<RefreshInterval>5 minutes</RefreshInterval>
<FreeAccessUntil>2013-01-15 09:12:27</FreeAccessUntil>
<NextExportAvailable>2013-09-11 17:58:56</NextExportAvailable>
</Info>
<Appointment>
<Ressource>
<![CDATA[ Hallen ]]>
</Ressource>
<StartDate>2013-09-11 15:00:00</StartDate>
<EndDate>2013-09-11 18:00:00</EndDate>
<Subject>
<![CDATA[ KIG - Gymnastik ]]>
</Subject>
<Description>
<![CDATA[ ]]>
</Description>
</Appointment>
<Appointment>
<Ressource>
<![CDATA[ KIG ]]>
</Ressource>
<StartDate>2013-09-11 15:00:00</StartDate>
<EndDate>2013-09-11 19:00:00</EndDate>
<Subject>
<![CDATA[ KIG - Gymnastik ]]>
</Subject>
<Description>
<![CDATA[ ]]>
</Description>
</Appointment>
</Calendar>
我已经用虚拟 XML 文件测试了我的 .aspx 页面,它运行良好!
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDataSource1">
<ItemTemplate>
<h3><%#XPath("Subject") %></h3>
<p>Start: <%#XPath("StartDate") %>. End: <%#XPath("EndDate") %></p>
</ItemTemplate>
</asp:Repeater>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://server.liveconnect.dk/xml/calendar/?cid=95&xid=e96de1864025d98d22b86537d02bb93e"></asp:XmlDataSource>
它不会显示数据。我担心的是 XML 中的 Info 元素会弄乱转发器。