Я никогда не использовал TBXML, я использую SMXMLDocument
А вот метод, который я использую для разбора RSS:
- (NSArray *) arrayNewsItemsFromDocument:(SMXMLDocument *)document {
SMXMLElement *channel = [document.root childNamed:@"channel"];
NSArray *itemArray = [channel childrenNamed:@"item"];
NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithCapacity:[itemArray count]];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
//Mon, 11 Jul 2011 00:00:00 +0200
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"EN"] autorelease]];
[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss ZZZZ"];
for (SMXMLElement *item in itemArray) {
News *news = [[News alloc] init];
news.title = [item childNamed:@"title"].value;
NSString *text = [item childNamed:@"encoded"].value;
news.text = [self stringFromHTMLString:text];
news.articleUrl = [item childNamed:@"link"].value;
NSString *dateString = [item childNamed:@"pubDate"].value;
NSDate *date = [dateFormatter dateFromString:dateString];
news.date = date;
[mutableArray addObject:news];
[news release], news = nil;
}
[dateFormatter release], dateFormatter = nil;
NSArray *newsArray = [[mutableArray copy] autorelease];
[mutableArray release], mutableArray = nil;
return newsArray;
}