title: Parsing xml from url in objective c
body: <p>i'm using the following code:</p>
  
  <pre><code>- (void)parserDidStartDocument:(NSXMLParser *)parser{
   NSLog(@"File found and parsing started");
  
   }
  
  
   - (void)parseXMLFileAtURL: (NSString *)URL;{
  
  
   NSString *agentString = @"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1";
   NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:
   [NSURL URLWithString:URL]];
   [request setValue:agentString forHTTPHeaderField:@"User-Agent"];
  
   xmlFile = [ NSURLConnection sendSynchronousRequest:request returningResponse: nil error: nil ];
  
  
   articles = [[NSMutableArray alloc] init];
   errorParsing= NO;
  
   rssParser = [[NSXMLParser alloc] initWithData:xmlFile];
  
   [rssParser setDelegate:self];
  
   // You may need to turn some of these on depending on the type of XML file you are parsing
   [rssParser setShouldProcessNamespaces:NO];
   [rssParser setShouldReportNamespacePrefixes:NO];
   [rssParser setShouldResolveExternalEntities:NO];
  
   [rssParser parse];
  
   }
  
  
   - (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError {
  
   NSString *errorString = [NSString stringWithFormat:@"Error code %i", [parseError code]];
   NSLog(@"Error parsing XML: %@", errorString);
  
  
   errorParsing=YES;
   }
  
  
   - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
   currentElement = [elementName copy];
   ElementValue = [[NSMutableString alloc] init];
   if ([elementName isEqualToString:@"intro"]) {
   item = [[NSMutableDictionary alloc] init];
  
   }
  
   }
  
  
   - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
   [ElementValue appendString:string];
   }
  
   - (void)parserDidEndDocument:(NSXMLParser *)parser {
  
   if (errorParsing == NO)
   {
   NSLog(@"XML processing done!");
   } else {
   NSLog(@"Error occurred during XML processing");
   }
  
   }
  </code></pre>
  
  <p>But on the line:</p>
  
  <blockquote>
    <p>xmlFile = [ NSURLConnection sendSynchronousRequest:request
    returningResponse: nil error: nil ];</p>
  </blockquote>
  
  <p>and:</p>
  
  <pre><code>rssParser = [[NSXMLParser alloc] initWithData:xmlFile];
  
   [rssParser setDelegate:self];
  </code></pre>
  
  <p>I got 2 errors:</p>
  
  <blockquote>
    <p><strong>Use of undeclared identifier 'xmlFile'</strong></p>
  </blockquote>
  
  <p>My .h file:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @class ontfsViewController;
  
  
  @interface artikels : UIViewController {
  
      ontfsViewController *detailViewController;
  
      IBOutlet UIWebView *errorView;
  
      //xml
      NSXMLParser *rssParser;
      NSMutableArray *articles;
      NSMutableDictionary *item;
      NSString *currentElement;
      NSMutableString *ElementValue;
      BOOL errorParsing;
  }
  
  @property (nonatomic, retain) IBOutlet ontfsViewController *detailViewController;
  
  @end
  </code></pre>
  
  <p>And i viewdidload:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view from its nib.
      [self parseXMLFileAtURL:@"http://****.com/get_recent_posts.xml"];
  
  
  }
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>[rssParser setDelegate:self];
  
  
   **Sending 'artikels *const__strong' tot parameter of incompatible type 'id&lt;NSXMLPARSERDELEGATE&gt;**
  </code></pre>
  
  <p>Does anyone now how to fix it?</p>