asp.net - XPath only works if I add an extra node -
i'm pretty new using xml , new xpath. i'm trying select field in xml document , display in label on webpage. sound nice , simple.
here code on webpage:
<body> <form id="form1" runat="server"> <div> <asp:listview id="newslistview" runat="server" datasourceid="newsdatasource"> <itemtemplate> <asp:label id="label1" runat="server" ><%#xpath("temp1")%></asp:label> </itemtemplate> </asp:listview> <asp:xmldatasource id="newsdatasource" runat="server" datafile="~/news.xml"></asp:xmldatasource> </div> </form> </body>
this works 100% fine when using xml document 1 below.
<test> <response> <temp1>23.7</temp1> </response> </test>
but xml document trying access, cannot change looks this:
<response> <temp1>23.7</temp1> </response>
basically same document without node @ top.
is there anyway can xpath read value of temp1 without node?
thanks.
im not familiar xpath looking @ documentation.. can add
<asp:repeater id="repeater1" runat="server" datasource='<%# xpathselect("response") %>' >
Comments
Post a Comment