Skip to content
This repository
Browse code

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 authored August 12, 2010 alexrepty committed September 04, 2010

Showing 1 changed file with 9 additions and 2 deletions. Show diff stats Hide diff stats

  1. 11  MGTwitterUserListsParser.m
11  MGTwitterUserListsParser.m
@@ -26,6 +26,11 @@ - (void)parser:(NSXMLParser *)theParser didStartElement:(NSString *)elementName
26 26
         NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
27 27
         [parsedObjects addObject:newNode];
28 28
         currentNode = newNode;
  29
+    } else if ([elementName isEqualToString:@"user"]) {
  30
+        // Add a 'user' dictionary to current node.
  31
+        NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
  32
+        [currentNode setObject:newNode forKey:elementName];
  33
+        currentNode = newNode;
29 34
     } else if (currentNode) {
30 35
         // Create relevant name-value pair.
31 36
         [currentNode setObject:[NSMutableString string] forKey:elementName];
@@ -36,8 +41,10 @@ - (void)parser:(NSXMLParser *)theParser didEndElement:(NSString *)elementName
36 41
   namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
37 42
 {
38 43
     [super parser:theParser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName];
39  
-    
40  
-    if ([elementName isEqualToString:@"user"]) {
  44
+
  45
+    if ([elementName isEqualToString:@"list"]) {
  46
+        currentNode = [parsedObjects lastObject];
  47
+    } else if ([elementName isEqualToString:@"user"]) {
41 48
         [self addSource];
42 49
         currentNode = nil;
43 50
     }

0 notes on commit 5c01a51

Please sign in to comment.
Something went wrong with that request. Please try again.