开发者

parsing a local saved XML file

Good morning every one,

I have donloaded an XML File to my documents folder but how can I determinate the path to the file so I can parse it?!?

开发者_如何学运维

I tryed it with

NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *localPath = [rootPath stringByAppendingPathComponent:@"test.xml"];

and i get this mesage:

/.../.../Library/Application Support/iPhone Simulator/4.0/Applications/AF71BAFD-2014-4A79-BEA8-D6D9D2A6BBDB/Documents/test.xml
Entity: line 1: parser error : Start tag expected, '<' not found
/.../.../Library/Application Support/iPhone Simulator/4.0/Applications/

the XML File is in the correct format since i can Parse without any problems from the server can anyone Help me with that?!?


Begin with logging the contents of the local file using:

NSLog(@"Local xml: %@", [NSString stringWithContentsOfFile:localPath
                                                  encoding:NSUFT8StringEncoding
                                                     error:NULL]);

Just to validate that the local contents are actually correct. Correct on the server does not guarantee that something did not went amiss on it's path to the client.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜