Parsing xml using NSData

leoperez

New Member
I am working with cocoa, I want to parse an xml file.
But there are 2 warnings in my code here
\[code\]incompatible Objective-C types 'struct NSString *', expected 'struct NSURL *' when passing argument 1 of 'initWithContentsOfURL:' from distinct Objective-C type\[/code\] and \[code\]class 'XMLParser' does not implement the 'NSXMLParserDelegate' protocol\[/code\]this is my code :\[code\]int main(int argc, char *argv[]){ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSData *data = http://stackoverflow.com/questions/11396316/[[NSData alloc] initWithContentsOfURL:@"/Users.xml"]; // here is the first warning // create and init NSXMLParser object NSXMLParser *nsXmlParser = [[NSXMLParser alloc] initWithData:data]; // create and init our delegate XMLParser *parser = [[XMLParser alloc] initXMLParser]; // set delegate [nsXmlParser setDelegate:parser]; // here is the second warning // parsing... BOOL success = [nsXmlParser parse]; // test the result if (success) { NSLog(@"No errors");// - user count : %i", [parser [users count]]); // get array of users here // NSMutableArray *users = [parser users]; } else { NSLog(@"Error parsing document!"); } [parser release]; [nsXmlParser release]; [pool drain]; return NSApplicationMain(argc, (const char **) argv);}\[/code\]How can I solve this please ? when i run , it tells me that the program received signal SIGABRT and it doesn't work
 
Back
Top