displaying hierarchical xml in asp.net - vb -
i've tried converting code c# vb it's not working , i'm not sure why. it's supposed render hierarchical xml.
here's code...
private sub page_load(sender object, e eventargs) dim doc new xmldocument() doc.load(server.mappath("~/myxml/getbooking.xml")) _rep1.datasource = doc.firstchild _rep1.databind() end sub
and
<asp:repeater id="_rep1" runat="server" enableviewstate="false"> <itemtemplate> publisher: <%# ctype(container.dataitem, xmlnode).attributes("name").value %><br/> <asp:repeater runat="server" enableviewstate="false" datasource='<%# container.dataitem %>' > <itemtemplate> author: <%# ctype(container.dataitem, xmlnode).attributes("name").value %><br/> <asp:repeater runat="server" enableviewstate="false" datasource='<%# container.dataitem %>' > <itemtemplate> <i> <%# ctype(container.dataitem, xmlnode).attributes("name").value %> </i><br /> </itemtemplate> </asp:repeater> </itemtemplate> </asp:repeater> <hr /> </itemtemplate> </asp:repeater>
with xml...
<publishers> <publisher name="new moon books" city="boston" state="ma" country="usa"> <author name="albert ringer "> <title name="is anger enemy?" /> <title name="life without fear" /> </author> <author name="john white "> <title name="prolonged data deprivation " /> </author> <author name="charlene locksley "> <title name="emotional security: new algorithm" /> </author> <author name="marjorie green "> <title name="you can combat computer stress!" /> </author> </publisher> <publisher name="binnet , hardley" city="washington" state="dc" country="usa"> <author name="sylvia panteley "> <title name="onions, leeks, , garlic" /> </author> <author name="burt gringlesby "> <title name="sushi, anyone?" /> </author> <author name="innes del castillo "> <title name="silicon valley gastronomic treats" /> </author> <author name="michel defrance "> <title name="the gourmet microwave" /> </author> <author name="livia karsen "> <title name="computer phobic , non-phobic" /> </author> </publisher> <!-- ... --> </publishers>
any ideas?
why not output <xmp>
tag around xml?
<xmp> <asp:literal id="myxml" runat="server" /> </xmp>
and in codebehind
myxml.text = doc.innerxml;
Comments
Post a Comment