views:

293

answers:

3

I am new to iPhone development. I want to display data taken from inside a html table from a web page. Is there any way to retrieve the data from the table in the html page? Html page is the source code of a page in a website. I have only the url of the webpage. From its source code(html file), I have to retrieve only a part of data from a table.

Please help me out.Thanks.

+2  A: 

Why don't you use the XPathQeury which is developed by Matt Gallagher.
This library is very nice to parse not only XML data but also HTML data by using XPath.
You could use the following function of XPathQuery.

NSArray *PerformHTMLXPathQuery(NSData *document, NSString *query);
tomute
+1  A: 

If you need to parse the html one of the suggestions for HTML parsers in this thread http://stackoverflow.com/questions/405749/parsing-html-on-the-iphone will work.

If you know exactly how the data will be tagged/formatted you could use NSScanner to quickly pluck the data out of the raw html.

TechZen
A: 

If you're also displaying the HTML using a UIWebView you can use it's method stringByEvaluatingJavaScriptFromString to get the part you need using JScript

Ron Srebro