Note that there are some explanatory texts on larger screens.

plurals
  1. POnot getting entire xml data into tableview
    text
    copied!<p>im parsing xml data into table view,here iam retrieving <strong>question</strong> and <strong>answer</strong> tags,problem occured in <strong>question</strong> tag only one question was displayed remaining questions not displayed ,this is the web service <a href="http://www.cmellc.com/DesktopModules/CaseChallenge/quiz.xml" rel="nofollow">http://www.cmellc.com/DesktopModules/CaseChallenge/quiz.xml</a><br> this is the code i wrote </p> <pre><code>- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { currentTag = elementName; if ([currentTag isEqualToString:@"question"]) { model = [[ModelDataView alloc]init]; } if([currentTag isEqualToString:@"answer"]) { model_2=[[Model2 alloc]init]; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if([elementName isEqualToString:@"question"]) { [dataControllerArray addObject:model]; } if ([elementName isEqualToString:@"answer"]) { [dataControllerArray2 addObject:model_2]; model_2 = nil; } currentTag = nil; } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if ([currentTag isEqualToString:@"result"]) { model_2.result = string; } if ([currentTag isEqualToString:@"notes"]) { model_2.notes = string; } if ([currentTag isEqualToString:@"question"]) { model.question = string; } } </code></pre> <p>this is code for tableview methods </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"cell"; static NSString *cellIdentifier2 = @"cell2"; UITableViewCell *cell; if(tableView.tag==2) { cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; } Model2 *obj=[modelController.dataControllerArray2 objectAtIndex:indexPath.row]; NSString *res=obj.result; cell.textLabel.text=res; return cell; } else if(tableView.tag==1) { cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier2]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier2] autorelease]; } ModelDataView *obj=[modelController.dataControllerArray objectAtIndex:indexPath.row]; NSString *res=obj.question; UIWebView *_webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 190)]; [self.view addSubview:_webView]; CGRect frame = _webView.frame; frame.size.height = 190; _webView.frame = frame; [_webView loadHTMLString:res baseURL:[NSURL URLWithString:res]]; return cell; } } </code></pre> <p>thank you for helping me</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload