views:

247

answers:

3

I have a very simple html page to parse. The html page will remain simple always. as simple as this

<html>
<head><title>title</title></head>
<body>some data here</body>
</html>

I have fetched the html content of such an html page and have it in an NSString. I want to get what ever data is there in the body of the html page.

Please tell me how can this be done and let me know if there are more than one possible ways. I would prefer doing it using basic obj-c if it is possible.

Thanks

A: 

If you control the content of the html page, you could simply use NSScanner to look for the tags you want. If you're looking for something that can handle more a complex set of tags, look into use NSXMLParser.

lucius
A: 

Hey, i have control on the HTML file. I am pretty new to this so can u show me a small example.

Consider i want to get data from the body on the html file. I have the content of the html page in an NSString,then how do i get the content of the body using NSScanner. ( in the above example "some data here" is the body content, how can i get that)

Thanks in advance

sitara
A: 

@Sitara, I had the same issue. I have to get the data from the body of html page. How to do this using NSScanner/HTMLParser. If you found the solution, can you post the sample code here..?