Posted By

trg on 01/29/10


Tagged

xml touchxml


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

mracoker
avanadra
shimdh
im3der
leoavesani
gospaz


TouchXML QuickQuide


 / Published in: Objective C
 

  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  

You need to login to post a comment.