2010年4月8日木曜日

Load XML from local

NSString *path = [[NSBundle mainBundle] pathForResource:@"Books" ofType:@"xml"];

NSData *xmlData = [NSData dataWithContentsOfFile:path];

NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:xmlData];

//Initialize the delegate.

XMLParser *parser = [[XMLParser alloc] initXMLParser];

//Set delegate

[xmlParser setDelegate:parser];

//Start parsing the XML file.

BOOL success = [xmlParser parse];

if(success)

NSLog(@"No Errors");

else

NSLog(@"Error Error Error!!!");