Hi, im using a xmlparser called SMXMLDocument.
SMXMLDocument
I use NSURLConnection and NSURL to fetch the XML down and that works fine. I can log it in the console.
Code:
- (void)connectionDidFinishLoading:(NSURLConnection *)conn
{
NSString *fetchedXML = [[[NSString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"%@", fetchedXML);
[xmlData release];
xmlData = nil;
[connection release];
connection = nil;
[self performSelector:@selector(parseXML)];
}
-(void)parseXML
{
SMXMLDocument *document = [SMXMLDocument documentWithData:xmlData error:nil];
SMXMLElement *content = [document.root childNamed:@"content"];
for (SMXMLElement *name in [content childrenNamed:@"name"])
{
NSString *name = [name valueWithPath:@"name"];
NSLog(@"name:%@", name);
}
}
I use this code in -(void)parseXML to parse the xml but nothing gets logged. Can anyone help me figure out what i am doing wrong?
My XML looks like this
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<content>
<name>John Doe</name>
</content>
Thanks!