Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
How to load XMl data from Web API into Listview.
Bha Sngh
Sep 30 2013 5:28 PM
1.1k
Reply
The webAPI is not providing any asmx file .
I am using one button and listview and text box.
In Textbox we put the name of the city.
OnClick Button event will load all the xml data into listview.
Since the webAPI is not providing any asmx file, we cannot use reference in asp.net.
my code is as follows:
XmlDocument xdoc = new XmlDocument();//xml doc used for xml parsing
xdoc.Load(
"http://api.indeed.com/ads/apisearch?publisher=***************&q=java&l=fremont%2C+ca&sort=&radius=&st=&jt=&start=&limit=&fromage=&filter=&latlong=1&co=us&chnl=&userip=1.2.3.4&useragent=Mozilla/%2F4.0%28Firefox%29&v=2"
);//loading XML in xml doc
XmlNodeList xNodelst = xdoc.DocumentElement.SelectNodes("results/result");//reading node so that we can traverse thorugh the XML
DataTable jobTable = new DataTable();
jobTable.ReadXmlSchema("xNodelst");
jobTable.ReadXml("xNodelst");
ListView1.DataSource = jobTable;
ListView1.DataBind();
foreach (ListViewItem lvi in ListView1.Items)
{
// what to put here...????
}
}
Thanks
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
rdr.EndOfStream shows function evaluation timeout
web services