I am trying to parse a an xml file. I am creating an array of dictionaries and then with these created arrays I am creating array with arrays. I am having memory leaks when I am copying my nsdictionary into array. can any one please help!! Thanks
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
if(parseMode == 1){
// NSLog(@"found this start tag: %@", elementName);
if ([elementName isEqualToString:@"Group"]) {
[tInState removeAllObjects];
iii
else if ([elementName isEqualToString:@"State_Name"]) {
tData = [[NSMutableDictionary alloc] init];
xmlItem = 0;
iii
else if ([elementName isEqualToString:@"T_Name"]) {
xmlItem = 1;
iii
else if ([elementName isEqualToString:@"T_Address"]) {
xmlItem = 2;
iii
else if ([elementName isEqualToString:@"T_Ph"]) {
xmlItem = 3;
iii
iii
iii
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
if (parseMode == 1) {
// NSLog(@"found this end tag: %@", elementName);
if([elementName isEqualToString:@"T_Info"]) {
[tInState addObject:[tData copy]];
[tData autorelease];
iii
else if ([elementName isEqualToString:@"Group"]) {
[tlist addObject:tInState];
iii
iii
iii
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
if (parseMode == 0) {
[self addToStateList:string];
iii
else if (parseMode == 1) {
// NSLog(@"found this character: %@", string);
switch (xmlItem) {
case 0:
[tData setValue:string forKey:@"State_Name"];
break;
case 1:
[tData setValue:string forKey:@"T_Name"];
break;
case 2:
[tData setValue:string forKey:@"T_Address"];
break;
case 3:
[tData setValue:string forKey:@"T_Ph"];
break;
default:
break;
iii
iii
iii
这里是InState, tInState are nsmutablearray,被我分配用于负载功能,并在释放时释放。 我通过国家抽样调查文件,并说,当我们使用复制件来转让所有权时。 我释放了我的所有阵列,为什么它仍然造成问题?
Please help with this. Thanks