Skip to content

Instantly share code, notes, and snippets.

@lfarah
Created July 22, 2014 18:14
Show Gist options
  • Save lfarah/451daf82d7549602344d to your computer and use it in GitHub Desktop.
Save lfarah/451daf82d7549602344d to your computer and use it in GitHub Desktop.
{
NSURL *url = [[NSURL alloc]initWithString:@"http://sistemas.ideastek.com.br/cnordeste/gols_jogadores.xml"];
NSXMLParser *parser = [[NSXMLParser alloc]initWithContentsOfURL:url];
[parser setDelegate:self];
BOOL result = [parser parse];
}
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
{
NSLog(@"Did start element");
if ( [elementName isEqualToString:@"root"])
{
NSLog(@"found rootElement");
return;
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
NSLog(@"Did end element");
if ([elementName isEqualToString:@"root"])
{
NSLog(@"rootelement end");
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
string = [string stringByReplacingOccurrencesOfString:@"\n " withString:@""];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment