XML 文件
<?xml version="1.0" encoding="utf-8"?>
<Eticket>
<BookingRef>17313</BookingRef>
<CompID>HA</CompID>
<DecimalPreference>2</DecimalPreference>
<AttachGDSRules>False</AttachGDSRules>
<FareDetails>
<BaseFare>1440</BaseFare>
<Fees>0</Fees>
</FareDetails>
<ClientInfo>
<Client>xyz abc</Client>
<Address>70 pqrlane</Address>
</ClientInfo>
</Eticket>
ASPX
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/temp/temp.xml"></asp:XmlDataSource>
<asp:ListView ID="ListView1" runat="server" DataSourceID = "XmlDataSource1">
<LayoutTemplate>
<div id="ItemPlaceholderContainer" runat="server">
<span id="ItemPlaceholder" runat="server"></span>
</div>
</LayoutTemplate>
<ItemTemplate>
<div class="Eticket">
<asp:Label ID="BookingRef" runat="server" datasrc="#text" Text='<%#XPath("BookingRef") %>'></asp:Label>
<asp:Label ID="CompID" runat="server" Text='<%#XPath("CompID") %>'></asp:Label>
<asp:Label ID="DecimalPreference" runat="server" Text='<%#XPath("DecimalPreference") %>'></asp:Label>
<asp:Label ID="BaseFare" runat="server" Text='<%#XPath("BaseFare") %>'></asp:Label>
<asp:Label ID="Client" runat="server" Text='<%#XPath("Client") %>'></asp:Label>
<asp:Label ID="Address" runat="server" Text='<%#XPath("Address") %>'></asp:Label>
</div>
</ItemTemplate>
</asp:ListView>
以上数据只返回子值,即
预期输出为:
17313 HA 2 1440 xyz abc 70 pqrlane
我得到的实际输出是:
1440 xyz abc 70 pqrlane
请让我知道我哪里出错了。
如果需要更多详细信息,希望这些信息就足够了。
谢谢