Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (34 sloc) 1.386 kb
//
// MGTwitterMiscParser.m
// MGTwitterEngine
//
// Created by Matt Gemmell on 06/06/2008.
// Copyright 2008 Instinctive Code. All rights reserved.
//
#import "MGTwitterMiscParser.h"
@implementation MGTwitterMiscParser
#pragma mark NSXMLParser delegate methods
- (void)parser:(NSXMLParser *)theParser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict
{
//NSLog(@"Started element: %@ (%@)", elementName, attributeDict);
[self setLastOpenedElement:elementName];
if (!currentNode) {
NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
[parsedObjects addObject:newNode];
currentNode = newNode;
}
// Create relevant name-value pair.
[currentNode setObject:[NSMutableString string] forKey:elementName];
}
- (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:@"remaining_hits"]) {
NSNumber *hits = [NSNumber numberWithInt:[[currentNode objectForKey:elementName] intValue]];
[currentNode setObject:hits forKey:elementName];
}
}
@end
Jump to Line
Something went wrong with that request. Please try again.