title: Error code 5 in application
body: <p>I have developed one application to fetch RSS feed. I am getting this error code 5 for some URLs where as som others are working fine.</p>
  <p>I know this error means the xml is invalid. But for my app, I have not written any xml files by my own.</p>
  <p>Please tell me the probable reasons for this and let me know the solution</p>
  <h1>import &quot;RootViewController.h&quot;</h1>
  <p>@implementation RootViewController</p>
  <ul>
  <li>(void)viewDidAppear:(BOOL)animated{</li>
  </ul>
  <p>[super viewDidAppear:animated];</p>
  <p>if ([stories count] == 0) {</p>
  <pre><code>    path = @&quot;http://172.19.58.108:8080/jwplayer/JSP/Videolist.jsp&quot;;
      [self parseXMLFileAtURL:path];
  }
  </code></pre>
  <p>}</p>
  <p>-(void)parseXMLFileAtURL:(NSString *)URL{</p>
  <pre><code>stories = [[NSMutableArray alloc]init];
  NSURL *xmlURL = [NSURL URLWithString:URL];
  rssParser = [[NSXMLParser alloc]initWithContentsOfURL:xmlURL];
  [rssParser setDelegate:self];
  [rssParser setShouldProcessNamespaces:NO];
  [rssParser setShouldReportNamespacePrefixes:NO];
  [rssParser setShouldResolveExternalEntities:NO];
  [rssParser parse];
  </code></pre>
  <p>}</p>
  <p>-(void)parserDidStartDocument:(NSXMLParser *)parser{</p>
  <pre><code>NSLog(@&quot;Found file and started parsing&quot;);
  </code></pre>
  <p>}</p>
  <p>-(void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError{</p>
  <pre><code>NSString *errorString = [NSString stringWithFormat:@&quot;Unable to download story feed from website (Error Code %i)&quot;, [parseError code]];
  NSLog(@&quot;Error parsing xml: %@&quot;, errorString);
  UIAlertView *errorAlert = [[UIAlertView alloc]initWithTitle:@&quot;Error loading content&quot; message:errorString delegate:self cancelButtonTitle:@&quot;OK&quot; otherButtonTitles:nil];
  [errorAlert show];
  </code></pre>
  <p>}</p>
  <p>-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{</p>
  <pre><code>currentElement = [elementName copy];
  if ([elementName isEqualToString:@&quot;item&quot;]) {
      
      item = [[NSMutableDictionary alloc]init];
      currentTitle = [[NSMutableString alloc]init];
      currentDate = [[NSMutableString alloc]init];
      currentSummary = [[NSMutableString alloc]init];
      currentLink = [[NSMutableString alloc]init];
  }
  </code></pre>
  <p>}</p>
  <p>-(void)parser: (NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{</p>
  <pre><code>if ([elementName isEqualToString:@&quot;item&quot;]) {
      
      [item setObject:currentTitle forKey:@&quot;title&quot;];
      [item setObject:currentDate forKey:@&quot;date&quot;];
      [item setObject:currentSummary forKey:@&quot;summary&quot;];
      [item setObject:currentLink forKey:@&quot;link&quot;];
      [stories addObject:[item copy]];
      NSLog(@&quot;adding story: %@&quot;, currentTitle);
  }
  </code></pre>
  <p>}</p>
  <p>-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{</p>
  <pre><code>if ([currentElement isEqualToString:@&quot;title&quot;]) {
      
      [currentTitle appendString:string];
  }
  else if ([currentElement isEqualToString:@&quot;link&quot;]) {
      
      [currentLink appendString:string];
  }
  else if ([currentElement isEqualToString:@&quot;description&quot;]) {
      
      [currentSummary appendString:string];
  }
  else if ([currentElement isEqualToString:@&quot;pubDate&quot;]) {
      
      [currentDate appendString:string];
  }
  </code></pre>
  <p>}</p>
  <p>-(void)parserDidEndDocument:(NSXMLParser *)parser{</p>
  <pre><code>[activityIndicator stopAnimating];
  [activityIndicator removeFromSuperview];
  NSLog(@&quot;all done&quot;);
  NSLog(@&quot;stories array has %d items&quot;, [stories count]);
  [newsTable reloadData];
  </code></pre>
  <p>}</p>