Created
March 15, 2009 12:27
-
-
Save soh335/79401 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSMutableDictionary *) _parse:(NSXMLNode *)node{ | |
NSMutableDictionary *dict = [NSMutableDictionary dictionary]; | |
NSArray *childs = [node children]; | |
for(NSXMLNode *_node in childs){ | |
if([_node name]){ | |
NSMutableDictionary *_d = [self _parse:_node]; | |
if([[dict objectForKey:[node name]] count] == 0){ | |
[dict setObject:[NSMutableDictionary dictionary] forKey:[node name]]; | |
} | |
[[dict objectForKey:[node name]] addEntriesFromDictionary:_d]; | |
} | |
} | |
if([childs count] < 2 && ![[childs lastObject] name]){ | |
[dict setObject:[node stringValue] forKey:[node name]]; | |
} | |
return dict; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment