title: UITableView - set up tableview with Hpple data
body: <p>I get some data from an xml file on the web using hpple. In my xml file I have a bunch of different sections that I get data from (About 20). </p>
  
  <p>Heres the code I am using to get the data </p>
  
  <pre><code>- (void)getMenuItems:(NSString*)url{
  
  NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
  [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
      //NSLog(@"response == %@", response);
  
      [self getDeli:data];
  }
  
  - (void)getDeli:(NSData*)deliData {
  TFHpple *Parser = [TFHpple hppleWithHTMLData:deliData];
  // 3
  NSString *XpathQueryString = self.deliString;
  
  NSArray *Nodes = [Parser searchWithXPathQuery:XpathQueryString];
  
  // 4
  NSMutableArray *newNodes = [[NSMutableArray alloc] initWithCapacity:0];
  for (TFHppleElement *element in Nodes) {
      // 5
      Items *item = [[Items alloc] init];
      [newNodes addObject:item];
  
      // 6
      item.title = [[element firstChild] content];
      item.title = [[[element firstChild] content]stringByReplacingOccurrencesOfString:@"\n" withString:@""];
  
  
      // 7
      item.url = [element objectForKey:@"href"];
  }
  
  // 8
  _deli = newNodes;
  [self.tableView reloadData];
  </code></pre>
  
  <p>}</p>
  
  <p>The code all works, and I get the data the problem is that not all the sections all have data, and setting the titles of the sections and setting the data in the CellForRowAtIndexPath is a hassle as I change it depeing on what is returned and same with the number of sections. </p>
  
  <p>So I looking to find out how much sections are returned how, and set that to the number of sections in tableview and then set the section headers to the title in the xml file section headers and such.</p>
  
  <p>So that I don't just set the header and row height to 0 if the section or cell is empty.</p>
  
  <p>I hope that makes sense...</p>
  
  <p>Here is most of xml file</p>
  
  <pre><code>&lt;day name="monday"&gt;
  &lt;meal name="DINNER"&gt;
  &lt;counter name="Chefs Choice"&gt;
  &lt;dish&gt;
  &lt;name&gt;Vegetable Samosa with Yogurt Sauce&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Tomato Red Pepper Chutney&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Curried Rice &amp; Lentils&lt;/name&gt;
  &lt;/dish&gt;
  &lt;/counter&gt;
  &lt;counter name="Entrée"&gt;
  &lt;dish&gt;
  &lt;name&gt;London Broil&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Oven Roast Rosemary Red Potatoes&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Glazed Fresh Carrots&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Salad Bar&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Cheddar Cheese &amp; Bacon Potato Salad&lt;/name&gt;
  &lt;/dish&gt;
  &lt;/counter&gt;
  &lt;counter name="Grill"&gt;
  &lt;dish&gt;
  &lt;name&gt;Hamburger&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Classic Cheeseburger on a Toasted Bun&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Chicken Sandwich&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;French Fries&lt;/name&gt;
  &lt;/dish&gt;
  &lt;/counter&gt;
  &lt;counter name="International"&gt;
  &lt;dish&gt;
  &lt;name&gt;Shell Pasta&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Spaghetti Sauce with Tomato Bits&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Alfredo Sauce&lt;/name&gt;
  &lt;/dish&gt;
  &lt;/counter&gt;
  &lt;counter name="Pizza"&gt;
  &lt;dish&gt;
  &lt;name&gt;Cheese Pizza&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Pepperoni Pizza&lt;/name&gt;
  &lt;/dish&gt;
  &lt;dish&gt;
  &lt;name&gt;Antipasto Pizza Slice&lt;/name&gt;
  &lt;/dish&gt;
  &lt;/counter&gt;
  &lt;counter name="Soup"&gt;
  &lt;dish&gt;
  &lt;name&gt;Tomato Soup Florentine&lt;/name&gt;
  &lt;/dish&gt;
  &lt;/counter&gt;
  &lt;counter name="Vegetable"&gt;
  &lt;dish&gt;
  &lt;name&gt;Eggplant Parmesan Casserole&lt;/name&gt;
  &lt;/dish&gt;
  &lt;/counter&gt;
  &lt;/meal&gt;
  &lt;/day&gt;
  </code></pre>
  
  <p>Thanks for the help in advance </p>