#pragma mark - XML Data
-(void)XMLData
{
NSURL *url = [[NSURL alloc]initWithString:@"http://four-developers.com/service1.svc/GetXmlData/aa"];
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
{
if ( [elementName isEqualToString:@"root"])
{
return;
}
}
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if ([elementName isEqualToString:@"root"])
{
NSLog(@"rootelement end");
}
}
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
NSString *tagName = @"column";
if([tagName isEqualToString:@"column"])
{
NSLog(@"Value %@",string);
}
}
No comments:
Post a Comment