How to read a local xml file
I want to create a NSURL object out of a NSString, where I use -fileURLWithPath:(NSString ) I put my xml file as my source file, and name it event.xml. But NSString URL = @"event.xml"; NSURL a = [NSURL fileURLWithPath:URL];
but then my xmlparser return a connection failed error.
so what's the correct way to specify the path of a xml in the source file?
sorry about the formatti开发者_JAVA技巧ng but I'm really in a rush
That depends on the directory your XML file is in. If we are talking about a file in your app bundle, it is:
NSString *path = [[NSBundle mainBundle] pathForResource:@"event" ofType:@"xml"];
精彩评论