Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c XML解析器后的空表单元格_Objective C_Xml_Uitableview - Fatal编程技术网

Objective c XML解析器后的空表单元格

Objective c XML解析器后的空表单元格,objective-c,xml,uitableview,Objective C,Xml,Uitableview,我在Tablecell中从XML解析器加载数据,工作正常。我在单元格中有自定义按钮,对于按钮操作,我再次解析另一个XML数据。问题是在按钮操作后,我丢失了Tablecell中的所有数据 //xml delegates - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString

我在Tablecell中从XML解析器加载数据,工作正常。我在单元格中有自定义按钮,对于按钮操作,我再次解析另一个XML数据。问题是在按钮操作后,我丢失了Tablecell中的所有数据

//xml delegates

 - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
 {

recordResults = false;
[nodeContent setString:@""];


 if([elementName isEqualToString:@"GetLeaveSummaryResult"])
 {
    recordResults = true;

 }
recordApproveResults = false;
[nodeapprove setString:@""];
NSLog(@"the Value of Node Value: %@",nodeapprove);

if([elementName isEqualToString:@"GetLeaveApproveResult"])
{
   recordApproveResults = true;

}
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
 {
if (recordResults)
{
    [nodeContent appendString:string];
}


string=[string stringByReplacingOccurrencesOfString:@"\"" withString:@""];

nodeapprove=[string mutableCopy]; 

if (recordApproveResults)
 {
   [nodeapprove appendString:string];
     NSLog(@"the Value of Node Value condition:%@",nodeapprove);
 }

 }


 - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{

recordResults = false;

if ([elementName isEqualToString:@"GetLeaveSummaryResult"])
{
    [arrayitems addObject:nodeContent];
    NSLog(@"The Array Count is: %d",[arrayitems count]);

}

recordApproveResults = false;

if([elementName isEqualToString:@"GetLeaveApproveResult"])
   ;
 {
   NSLog(@"nodeapprove= %@",nodeapprove);

   if ([nodeapprove isEqualToString:@"Rejected"])
    {
        NSLog(@"came inside");
    }
     stringapprove= nodeapprove;
    NSLog(@"%@",stringapprove);
}

[studentTableView reloadData];


}

您是否使用相同的XML解析器来解析主XML和其他XML(按按钮时需要)?或者检查表视图委托方法。如果您正在调用reloaddata函数,那么数组可能为emptyHi,我使用的是相同的XML解析器,但调用的是diff方法。在按钮操作中,使用另一个数据解析器,我需要再次重新加载数据。你可以签入我的代码。