views:

53

answers:

1

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?!?

A: 

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.

PeyloW
Thanks for the tip it just leads me in the right direction i forgot the encoding and now it works....
zim