Skip to content

How to parse URL from RSS feed with NSXMLParser

by paddoum on December 6th, 2010

When you parse URL from RSS feeds there are, most of the time, unwanted characters (not directly visible) that prevent you from opening a page from within your iPhone app. The solution below is not perfect but does the job.

// Get the actual string
NSString *storyURL = [NSString stringWithFormat:@"%@", self.selectedURL];
// Break it at control characters. This will give an array with multiple objects
NSArray *brokenString = [storyURL componentsSeparatedByCharactersInSet:[NSCharacterSet controlCharacterSet]];
// Get the clean URL
NSString *webURL = [NSString stringWithFormat:@"%@", [brokenString objectAtIndex:0]];

From → Development

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS