I can read remote XML with the following code:
-(id)loadXMLByURL:(NSString *)urlString
{
tweets = [[NSMutableArray alloc] init];
NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:urlString];
NSURL *url = [NSURL URLWithString:urlString];
parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
parser.delegate = self;
[parser parse];
return self;
}
And I'm calling the above function here:
- (void)viewDidLoad
{
xmlcont = [[XMLController alloc] loadXMLByURL:@"http://192.168.10.12:81/book.xml"];
for (Tweet *t in [xmlcont tweets]) {
NSLog(@"At date: %@ you wrote: %@",[t createdAt], [t content]);
}
[super viewDidLoad];
}
Actually I'd like to do something like this, little as one difference. I want to read a XML local file that is in my resource folder on my Project in XCode, but definitelly I don't know how to do this! I'm getting crazy with that! I'm just can to read XML remote file (http://..../file.xml).