how to pass local path to NSXMLParser
like this
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:storePath];
where storepath is a local path like this:
/var/mobile/Applications/56EEB906-2B73-493C-9BE7-2732440CDB69/Documents/xml1.php
and my code is like this:
//NSURL *urla = [[NSURL alloc] initWithString:storePath];
NSURL *urla = [[[NSURL alloc] init] fileURLWithPath:storePath];
//NSData *dataa = [NSData dataWithContentsOfURL:urla];
NSLog(@"urls ois %@",urla);
help me why i am getting null value
Try this one:
More details at iPhone Application Programming Guide: Getting Paths to Application Directories.
Update: There’s a common misunderstanding what
stringByTrimmingCharactersInSet. It does not replace all whitespace in the string, it only removes leading and trailing whitespace.If you want to get rid of the spaces, you need to replace them yourself by using something like
stringByReplacingCharactersInRange:withString:.However:
<app>/Documents/xml1.phpfile, of course); and according toNSXMLParserdocumentation,initWithContentsOfUrlaccepts any fully qualified URL with scheme supported byNSURL, andfile://is supported scheme.If there’s a particular error the
NSXMLParseris returning, add it to your question (or ask another one), so we can help you with the actual problem.