Posted By


trg on 01/29/10

Tagged


Statistics


Viewed 90 times
Favorited by 2 user(s)

Related snippets


TouchXML QuickQuide


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. - (void)viewDidLoad {
  2. [super viewDidLoad];
  3. NSLog(@"Begin TouchXML Tutorial Code");
  4.  
  5. // This is the TouchXML XMLDocument class. We're going to initialize it with our publicTimelineUrl URL from above.
  6. CXMLDocument *xmlParser = [[[CXMLDocument alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://twitter.com/statuses/public_timeline.xml"] options:0 error:nil] autorelease];
  7. /* Here we use XPath to create an NSArray of usernames */
  8. NSArray *twitterUsernames = [xmlParser nodesForXPath:@"/statuses/status/user/screen_name" error:nil];
  9.  
  10. // Loop through them and print
  11. for (CXMLElement *username in twitterUsernames) {
  12. NSLog(@"username = %@", [username stringValue]);
  13. }
  14.  
  15. NSLog(@"End TouchXML Tutorial Code");
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.