My php response in xml is of this type
<users>
<username>myemail</username>
<password>mypass</password>
</users>
Now this is my parseUrl class
NSURL *parserUrl = [[[NSURL alloc] initWithString:urlString] autorelease];
NSXMLParser *parser = [[[NSXMLParser alloc] initWithContentsOfURL:parserUrl] autorelease];
[parser setDelegate:self];
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
if ( [elementName isEqualToString:@"users"])
{
return;
}
if ( [elementName isEqualToString:@"username"] )
{
NSString *val = [attributeDict objectForKey:@"username"] ;
return;
}
}
Now the problem is, the attributeDict
is giving 0 pairs. The function is reading username, password and users
meaning it can get inside this loop
if ( [elementName isEqualToString:@"username"] )
{
NSString *val = [attributeDict objectForKey:@"username"] ;
return;
}
But how can i retrieve the value of this node?