Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-02-2010, 05:00 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 50
JavaWizKid is on a distinguished road
Question Pulling text from the internet

I know how to pull text from the internet using the simple
Code:
#define kTextURL	@"http://www.website.com/text.txt"
But how do I select certain parts of the text on a html page like this one. How could I pull say the current hot tags?
__________________
Discover new apps through art! Sound weird? Check it out! BigAppAd!
Follow me on Twitter!
JavaWizKid is offline   Reply With Quote
Old 11-03-2010, 04:02 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by JavaWizKid View Post
I know how to pull text from the internet using the simple
Code:
#define kTextURL	@"http://www.website.com/text.txt"
But how do I select certain parts of the text on a html page like this one. How could I pull say the current hot tags?
this is something called "parsing"

Let me google that for you
__________________
dany_dev is offline   Reply With Quote
Old 11-03-2010, 11:05 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 50
JavaWizKid is on a distinguished road
Default

THANKS, this is perfect! I forgot about the word parse haha. I've came across "pple" which is a html/xml parser for iPhone. I've correctly installed it and created the following code:

Code:
	NSData *data = [[NSData alloc] initWithContentsOfFile:@"http://www.javawizkid.com/"];
	
	// Create parser
	TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:data];
	
	NSArray *elements  = [xpathParser search:@"//title"];
	
	NSLog(@"%@",elements);
However, it kees spitting out the error, unable to parse. No idea why?
__________________
Discover new apps through art! Sound weird? Check it out! BigAppAd!
Follow me on Twitter!
JavaWizKid is offline   Reply With Quote
Old 11-03-2010, 11:55 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by JavaWizKid View Post
THANKS, this is perfect! I forgot about the word parse haha. I've came across "pple" which is a html/xml parser for iPhone. I've correctly installed it and created the following code:

Code:
	NSData *data = [[NSData alloc] initWithContentsOfFile:@"http://www.javawizkid.com/"];
	
	// Create parser
	TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:data];
	
	NSArray *elements  = [xpathParser search:@"//title"];
	
	NSLog(@"%@",elements);
However, it kees spitting out the error, unable to parse. No idea why?
and exactly which is the error?

have you added all needed files?
have you imported? #import "TFHpple.h"

Code:
initWithContentsOfFile:@"http://www.javawizkid.com/"
ehm......you think that it is a file?
download the file with NSUrlConnection or AsiHttpRequest and then load it as file or use initWithContentsOfUrl:myUrl
__________________
dany_dev is offline   Reply With Quote
Reply

Bookmarks

Tags
internet, url

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 344
12 members and 332 guests
7twenty7, chiataytuday, condor304, Creativ, Domele, dreamdash3, laureix68, LEARN2MAKE, mistergreen2011, mottdog, palme2elie, Paul Slocum
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,660
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, laureix68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:24 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0