title: How do i fill an UIPickerView with text strings during Do-While Loop
body: <p>I got a method to loop through an XML document. The method has a Do-While Loop like this:</p>
  
  <pre><code>do {
  
      if([[TBXML elementName:element] isEqualToString:@"establishment"]) {
  
          NSString *establishment= [TBXML textForElement:element];
  
          NSLog(establishment);
  
          [establishment release];
  
      }
  
      if (element-&gt;firstChild) 
          [self traverseElement:element-&gt;firstChild];
  
      // Obtain next sibling element
  } while ((element = element-&gt;nextSibling));
  </code></pre>
  
  <p>What i want to do is: Each time the loop passes the node  it has to write</p>
  
  <pre><code>[TBXML textForElement:element];
  </code></pre>
  
  <p>To an UIPickerView. The number of establishments is dynamic, so i never know in advance.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Is this the right way to fill my array?</p>
  
  <pre><code>- (void) traverseElement:(TBXMLElement *)element {
    do {
      if([[TBXML elementName:element] isEqualToString:@"establishment"]) {
  
      NSString *establishmentName = [TBXML textForElement:element];    
      NSMutableArray *stringsArray;
      [stringsArray addObject:establishmentName];
  
  
      }
      // if the element has child elements, process them
      if (element-&gt;firstChild) 
          [self traverseElement:element-&gt;firstChild];
  
      // Obtain next sibling element
   } while ((element = element-&gt;nextSibling));
  
  
  }
  </code></pre>
  
  <p>Because i don't have a clue where i have to alloc the uipickerview. Should i do that in my method where i am parsing the XML?</p>
  
  <p>And i don't know where to get the datasource..</p>