Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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...
commit 5c01a51390b72856d2a19eac809aa41cc84d1594 1 parent 0b58bc2
Clint catsby authored alexrepty committed
Showing with 9 additions and 2 deletions.
  1. +9 −2 MGTwitterUserListsParser.m
11 MGTwitterUserListsParser.m
View
@@ -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];
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.