从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];
}