Click here to Skip to main content
15,883,990 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have access to an XML API in the form of a URL link as an example, but I want to create a search box (in asp.net) so that users can search for the data with a set of the parameters and return/display the results based on their parameters selected e.g. holiday websites. Firstly, I just want to display the data on the browser AS A TEST so to make sure the data is returned, but I keep getting the following error:
(name is neither a DataColumn nor a DataRelation for table result.). It seems there is a problem with the node structure? Below is the ASP.NET page and also the xml file

XML
sub Page_Load
if Not Page.IsPostBack then
   dim myproducts=New DataSet
myproducts.ReadXml("http://api.example.com/1.0/products.xml")
   products.DataSource=myproducts
   products.DataBind()
end if
end sub
</script>
<html>
<body>
<form runat="server">
<asp:Repeater id="products" runat="server">

<HeaderTemplate>
<table border="1" width="100%">
<tr>
<th>name</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr>
  <div>City: <%#Container.DataItem("name")%></div>
</ItemTemplate>


-----------------------------------------------------------------

Below is the extract of the XML from the API URL

XML
<result xmlns="urn:com:example:pf:model:xml:output" xmlns:ns2="urn:com:tradedoubler:pf:model:xml:common" version="3.0">
<productHeader>...</productHeader>
<products>
<product language="en">...</product>
<product language="en">
<ns2:name>Pisa Holidays</ns2:name>
<ns2:description>Pisa Holidays</ns2:description>
<ns2:productImage>
http://me.jpg
</ns2:productImage>
<ns2:categories>


Any help would be appreciated
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900