title: How to wait for NSXMLParser to complete in iOS
body: <p>I want to wait for NSXMLParser process to complete and then continue with other processes. I use NSXMLParser to parse XML data.</p>
  
  <p>This is my code:</p>
  
  <pre><code> - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
  {
     NSLog(@"Did start element");
     if ( [elementName isEqualToString:@"FILENAME"])
     {
         XML_FIELD = FILENAME_CLOUD2;
         NSLog(@"found rootElement");
         return;
     }
     else if ( [elementName isEqualToString:@"UPLOADTIME"])
     {
         NSLog(@"found rootElement");
         XML_FIELD = UPLOADTIME2;
         return;
     }
  
  }
  </code></pre>
  
  <p>didEndElement():</p>
  
  <pre><code> - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
  {
     NSLog(@"Did end element");
     if ([elementName isEqualToString:@"FILENAME"])
     {
        NSLog(@"rootelement end");
     }
     XML_FIELD = UNIMPORTANT2;
  }
  </code></pre>
  
  <p>foudCharaters():</p>
  
  <pre><code>- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
  {
     if (XML_FIELD == FILENAME_CLOUD2)
     {
        NSLog(@"Value %@",string);
        [FileCompletedArray insertObject:string atIndex:0];
     }
     else if (XML_FIELD == UPLOADTIME2)
     {
        NSLog(@"Value %@",string);
        [UploadTimeArray insertObject:string atIndex:0];
     }
  }
  </code></pre>
  
  <p>Above code is used to get data from NSXMLParser but my app needs to wait for the parse xml process to complete. Can I use <code>dispatch ()</code> ?</p>