Return to Snippet

Revision: 23101
at January 29, 2010 20:12 by trg


Updated Code
- (void)viewDidLoad {
        [super viewDidLoad];
	NSLog(@"Begin TouchXML Tutorial Code");
	
	// This is the TouchXML XMLDocument class.  We're going to initialize it with our publicTimelineUrl URL from above.
       CXMLDocument *xmlParser = [[[CXMLDocument alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://twitter.com/statuses/public_timeline.xml"] options:0 error:nil] autorelease];
	/* Here we use XPath to create an NSArray of usernames */
	NSArray *twitterUsernames = [xmlParser nodesForXPath:@"/statuses/status/user/screen_name" error:nil];
	
	// Loop through them and print
	for (CXMLElement *username in twitterUsernames) {
		NSLog(@"username = %@", [username stringValue]);
        }
	
	NSLog(@"End TouchXML Tutorial Code");
}

Revision: 23100
at January 29, 2010 20:12 by trg


Initial Code
// This is the TouchXML XMLDocument class.  We're going to initialize it with our publicTimelineUrl URL from above.
    CXMLDocument *xmlParser = [[[CXMLDocument alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://twitter.com/statuses/public_timeline.xml"] 
																   options:0 error:nil] 
							   autorelease];
	/* Here we use XPath to create an NSArray of usernames */
	NSArray *twitterUsernames = [xmlParser nodesForXPath:@"/statuses/status/user/screen_name" error:nil];
	
	// Loop through them and print
	for (CXMLElement *username in twitterUsernames) {
		NSLog(@"username = %@", [username stringValue]);
    }

Initial URL

                                

Initial Description

                                

Initial Title
TouchXML QuickQuide

Initial Tags
xml

Initial Language
Objective C