Permalink
Browse files

fixed trimming of xml data including newlines

  • Loading branch information...
1 parent 624ae2c commit 1ec42b3cdaddc02ab761931adc35c334cbcca712 @rodnaph committed Jul 17, 2011
Showing with 3 additions and 4 deletions.
  1. +1 −3 neveroutofbeta/EpisodeFeedParser.m
  2. +2 −1 neveroutofbetaTests/EpisodeFeedParserTest.m
View
4 neveroutofbeta/EpisodeFeedParser.m
@@ -51,8 +51,6 @@ - (NSMutableArray *)getEpisodesFromUrl:(NSURL *)url {
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
-
-
if ( [elementName isEqualToString:@"item"] ) {
if ( currentEpisode != nil ) {
@@ -74,7 +72,7 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names
else if ( currentEpisode != nil ) {
- NSString *string = [currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
+ NSString *string = [currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\r\n\t "]];
if ( [elementName isEqualToString:@"link"] ) {
currentEpisode.link = [NSURL URLWithString:string];
View
3 neveroutofbetaTests/EpisodeFeedParserTest.m
@@ -22,8 +22,9 @@ - (void)testAllEpisodesFromFeedReturned {
- (void)testEpisodesInFeedHavePropertiesCorrectlySet {
Episode *episode = (Episode *) [[parser getEpisodesFromUrl:xmlUrl] objectAtIndex:1];
+ NSLog( @"Debug: %@", episode.description );
STAssertTrue( [episode.title isEqualToString:@"the episode title"], @"Title incorrect" );
- STAssertTrue( [episode.description isEqualToString:@"the <b>episode</b> description"], @"Description incorrect" );
+ STAssertTrue( [episode.description isEqualToString:@"The <b>episode</b> description"], @"Description incorrect" );
}
@end

0 comments on commit 1ec42b3

Please sign in to comment.