Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed issue where User node wasn't being created in the XML parser,
which caused the user id to take the place of the list id and the
results to not be properly structured.
  • Loading branch information
catsby authored and alexrepty committed Sep 4, 2010
1 parent 0b58bc2 commit 5c01a51
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions MGTwitterUserListsParser.m
Expand Up @@ -26,6 +26,11 @@ - (void)parser:(NSXMLParser *)theParser didStartElement:(NSString *)elementName
NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
[parsedObjects addObject:newNode];
currentNode = newNode;
} else if ([elementName isEqualToString:@"user"]) {
// Add a 'user' dictionary to current node.
NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
[currentNode setObject:newNode forKey:elementName];
currentNode = newNode;
} else if (currentNode) {
// Create relevant name-value pair.
[currentNode setObject:[NSMutableString string] forKey:elementName];
Expand All @@ -36,8 +41,10 @@ - (void)parser:(NSXMLParser *)theParser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
[super parser:theParser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName];

if ([elementName isEqualToString:@"user"]) {

if ([elementName isEqualToString:@"list"]) {
currentNode = [parsedObjects lastObject];
} else if ([elementName isEqualToString:@"user"]) {
[self addSource];
currentNode = nil;
}
Expand Down

0 comments on commit 5c01a51

Please sign in to comment.